akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void)
{
    int k, x;
    cin >> k >> x;

    for (int i = x-k+1; i <= x+k-1; i++) {
        cout << i;
        if (i == x+k-1) cout << endl;
        else cout << " ";
    }
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>

signed main() {
	int n, k;
	scanf("%d%d", &n, &k);
	if (k > (n - 2) * (n - 1) / 2) {
		puts("-1\n");
	} else {
		printf("%d\n", n * (n - 1) / 2 - k);
		for (int i = 1; i <= n - 1; ++i) {
			printf("%d %d\n", i, n);
		}
		int c = (n - 2) * (n - 1) / 2 - k;
		for (int i = 1; i <= n - 2; ++i) {
			for (int j = i + 1; j <= n - 1; ++j) {
				if (c > 0) {
					printf("%d %d\n", i, j);
					--c;
				} else {
					return 0;
				}
			}
		}
	}
}


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


int main(){
    // あとで消す
    //std::ifstream in("bin3.txt");
    //std::cin.rdbuf(in.rdbuf());

    int A,B;
    cin >> A >> B;

    int counter=0,buff=1;

    while(buff<B){
        buff=buff+A-1;
        counter++;
    }
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 2000000
#define T 10000
int A[N+1],B[N+1],n;
void CountingSort(int *A,int *B,int k){
  int i,j,C[N];
  for(i=0;i<=k;i++){
    C[i]=0;
  }
  for(j=1;j<=n;j++){
    C[A[j]]=C[A[j]]+1;
  }

  for(i=1;i<=k;i++){
    C[i] = C[i]+C[i-1];
  }

  for(j=n;j>0;j--){
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
  
}
int main(){
  int k =0,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(A[i]>=k) k=A[i];
  }
  k++;
  CountingSort(A,B,k);

  for(i=1;i<=n;i++){
    if(i!=1) printf(" ");
    printf("%d",B[i]);
    // printf("(%d)",i);
    //printf("%d",A[i]);
  }
  printf("\n");
  return 0;

}

Measured memory_bytes: 16272
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << '\n'

typedef int64_t Int;
const double pi = M_PI;

using namespace std;

int main() {
    int n;
    cin >> n;
    set<int> d;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        d.insert(a);
    }

    int count = d.size();

    cout << count << endl;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n = sc.nextInt();
		int[] p = new int[n];
		int[] q = new int[n];
		boolean[] checked = new boolean[n];
		for (int i = 0; i < n; i++)
			p[i] = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = n-1; i >= 0; i--) {
			if (!checked[i]) {
				checked[i] = true;
				if (p[i] == 0) q[i] = i;
				else {
					int index = i;
					list.clear();
					list.add(index);
					while (true) {
						index = p[index] > 0 ? min(index+p[index], n-1) : max(index+p[index], 0);
						if (checked[index]) {
							int c;
							if (list.contains(index)) c = -1;
							else c = q[index];
							for (int j : list) {
								q[j] = c;
							}
							break;
						}
						if (p[index] == 0) {
							q[index] = index;
							for (int j : list)
								q[j] = index;
							break;
						}
						list.add(index);
						checked[index] = true;
					}
				}
			}
		}
		Queue<Integer> num = new LinkedList<Integer>();
		Queue<Integer> count = new LinkedList<Integer>();
		boolean[] used = new boolean[n];
		num.add(0);
		count.add(0);
		used[0] = true;
		while (!num.isEmpty()) {
			int k = num.poll(), c = count.poll();
			if (k == n-1) {
				out.println(c);
				return;
			}
			for (int i = 1; i <= 6; i++) {
				if (!used[min(k+i, n-1)] && q[min(k+i, n-1)] > 0) {
					used[min(k+i, n-1)] = used[q[min(k+i, n-1)]] = true;
					num.add(q[min(k+i, n-1)]);
					count.add(c+1);
				}
			}
		}
		
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 65064
fn main() {
    proconio::input! {
        n: usize,
        x: String,
    }

    let bp = x.match_indices('1').count() as u64;
    let p = if bp == 1 { [2, 1] } else { [bp + 1, bp - 1] };

    let xr: Vec<char> = x.chars().rev().collect();

    let mut pows = vec![[1, 1]; n];
    let mut xv = if xr[0] == '1' { [1, 1] } else { [0, 0] };
    for i in 1..n {
        for j in 0..=1 {
            pows[i][j] = (pows[i - 1][j] * 2) % p[j];
            if xr[i] == '1' {
                xv[j] += pows[i][j];
                xv[j] %= p[j];
            }
        }
    }

    for i in (0..n).rev() {
        if bp == 1 && xr[i] == '1' {
            println!("0");
        } else {
            let xi = if xr[i] == '0' {
                (xv[0] + pows[i][0]) % p[0]
            } else {
                let p = if xv[1] >= pows[i][1] { 0 } else { p[1] };
                xv[1] + p - pows[i][1]
            };
            println!("{}", 1 + pop_pop_count(xi));
        }
    }
}

fn pop_pop_count(mut v: u64) -> u64 {
    let mut r = 0;
    while v > 0 {
        v %= v.count_ones() as u64;
        r += 1;
    }
    r
}


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

int main() {
    int h,w;
    cin>>h>>w;

    vector<vector<char>>a(h+2,vector<char>(w+2,'#'));

    rep(i,1,h+1){
        rep(j,1,w+1){
            cin>>a[i][j];
        }
    }

    rep(i,0,h+2){
        rep(j,0,w+2){
            cout<<a[i][j];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define SORT(v) sort(v.begin(), v.end());
#define REVERSE(v)  reverse(v.begin(), v.end());
typedef long long ll;
using namespace std;

int main() {
  int N; cin>>N;
  string ans="";
  
  if(N == 0) {
    cout<<"0"<<endl;
    return 0;
  }

  while(N != 0) {
    if(N%2 != 0) {
      N--;
      ans = "1" + ans;
    } else {
      ans = "0" + ans;
    }
    N /= -2;
  }

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

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
#define REPS(a,i,n) for(int i = a ; i < n ; ++i)
using namespace std;

int tile[20][20];


int main(){

	while (true){
		string a;
		if (cin.eof())
			break;
		/*
		for (size_t c = a.find_first_of(" "); c != string::npos;  c = a.find_first_of(" ")){
			a.erase(c, 1);
		}
		*/
		getline(cin, a);
		if (a.empty())continue;
		REP(j, 8){
			tile[3][7+3 - j] = '0' - a[7-j];
		}
		REP(i, 7){
			getline(cin,a); 
			/*for (size_t c = a.find_first_of(" "); c != string::npos; c = a.find_first_of(" ")){
				a.erase(c, 1);
			}*/

			REP(j, 8){
				tile[i+3 + 1][7+3 - j] = '0' - a[7-j];
			}
		}
		REP(i, 15){
			REP(j, 15){
				if (tile[i][j]){
					if (tile[i + 1][j] && tile[i][j + 1] && tile[i + 1][j + 1]){
						cout << "A" << endl;
						goto END;
					}
					if (tile[i][j+1] && tile[i+1][j + 1] && tile[i + 1][j + 2]){
						cout << "E" << endl;
						goto END;
					}
					if (tile[i+1][j] && tile[i+1][j + 1] && tile[i + 2][j + 1]){
						cout << "F" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i][j + 1] && tile[i + 1][j - 1]){
						cout << "G" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i+2][j] && tile[i + 3][j]){
						cout << "B" << endl;
						goto END;
					}
					if (tile[i][j+1] && tile[i][j + 2] && tile[i][j + 3]){
						cout << "C" << endl;
						goto END;
					}
					if (tile[i + 1][j] && tile[i+1][j - 1] && tile[i + 2][j - 1]){
						cout << "D" << endl;
						goto END;
					}
				}
			}
		}
	END:;
	}
	return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll max(ll a, ll b){
    if(a > b) return a;
    else return b;
}
 
ll min(ll a, ll b){
    if(a < b) return a;
    else return b;
}

int main(void){
    int N; cin >> N;
    vector<int> a(N); for(int i = 0; i < N; i++) cin >> a[i];
    
    int light = a[0];
    bool OK = false;
    int count = 1;
    for(int i = 0; i < N; i++){
        if(light - 1 == 1){
            OK = true;
            break;
        }
        light = a[light-1];
        count++;
    }
    if(OK) cout << count << endl;
    else cout << -1 << endl;
}

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

const int N=100010;
int arr[N], dp[N];
int calc(int n, int k) {
    dp[1] = 0;
    for (int i=2;i<=n;i++) {
        dp[i] = INT_MAX;
        for (int j=i-1;j>=max(1, i-k); j--) {
            dp[i] = min(dp[i], dp[j]+abs(arr[i]-arr[j]));
        }
        
    }
    int su=0;
    return dp[n];
}
int main() {
    int n,k;
    cin>>n>>k;
    for (int i=1;i<=n;i++)cin>>arr[i];
    cout<<calc(n,k)<<"\n";
    return 0;
}   

Measured memory_bytes: 1152
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int maxn = 100 + 10;
struct node{
	int x,y;
	bool operator < (const node&tmp)const{
		return (x < tmp.x)&&(y < tmp.y);
	}
};
node red[maxn],blue[maxn];
int line[maxn][maxn];
int used[maxn],r[maxn];
int n;
bool found(int x){
	for(int i = 1;i <= n;++i){
		if(line[x][i]&&!used[i]){
			used[i] = 1;
			if(r[i] == 0||found(r[i])){
				r[i] = x;
				return 1;
			}
		}
	}
	return 0;
	
}
int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;++i){
		scanf("%d%d",&red[i].x,&red[i].y);
	}
	for(int i = 1;i <= n;++i)scanf("%d%d",&blue[i].x,&blue[i].y);
	for(int i = 1;i <= n;++i)
	for(int j = 1;j <= n;++j)
	if(red[i] < blue[j])line[i][j] = 1;
	int sum = 0;
	for(int i = 1;i <= n;++i)
	{
		memset(used,0,sizeof(used));
		if(found(i))sum++;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 200005
#define P 1000000007
#define INV 500000004
#define G 3
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
#define fuck printf("FUCK!!\n");
using namespace std;

int n, m, ipow[MAXN], fac[MAXN], ifac[MAXN];

void init()
{
    ifac[0]=fac[0]=ifac[1]=fac[1]=ipow[0]=1;
    for(rint i=1; i<=n+m; ++i) ipow[i]=1LL*ipow[i-1]*INV%P;
    for(rint i=2; i<=n+m; ++i) ifac[i]=1LL*ifac[P%i]*(P-P/i)%P;
    for(rint i=2; i<=n+m; ++i)
    {
        ifac[i]=1LL*ifac[i-1]*ifac[i]%P;
        fac[i]=1LL*fac[i-1]*i%P;
    }
}

inline int comb(int x, int y)
{
    if(y>x) return 0;
    return 1LL*fac[x]*ifac[y]%P*ifac[x-y]%P;
}

int main()
{
    scanf("%d%d", &n, &m);
    init();
    int sum1=0, sum2=1;
    for(rint i=1; i<=n+m; ++i)
    {
        printf("%lld\n", ((1LL*sum2*INV%P+sum1)*ipow[i-1]%P+P)%P);
        sum1=(2LL*sum1+comb(i-1, m-1))%P;
        sum2=(2LL*sum2-comb(i-1, m-1)-comb(i-1, n-1))%P;
    }
    return 0;
}

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

int main() 
{
	vector<string>p={"Sunny","Cloudy", "Rainy"};
	string s; cin>>s;
	if(s==p[0]){cout<<p[1];}
	else if(s==p[1]){cout<<p[2];}
	else {cout<<p[0];}
	
	
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

class Main {
    static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static final PrintWriter pw = new PrintWriter(System.out);
    public static void main(String[] args) throws IOException {
        int num = Integer.parseInt(br.readLine()) - 1;
        String[] inputs = br.readLine().split(" ");
        int[] nums = new int[num];
        for(int i = 0; i < num; i++) {
            nums[i] = Integer.parseInt(inputs[i]);
        }

        Map<Integer,List<Integer>> map = Arrays.stream(nums).mapToObj(s -> s).collect(Collectors.groupingBy(s -> s));
        for(int i = 1; i <= num + 1; i++) {

            pw.println(map.containsKey(i) ? map.get(i).size() : 0);
        }

        pw.flush();
    }
}

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

using namespace std;

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


  if(s == "SUN"){
    cout << 7 << endl;
    return 0;
  } else if(s == "MON"){
    cout << 6 << endl;
    return 0;
  } else if(s == "TUE"){
    cout << 5 << endl;
    return 0;
  } else if(s == "WED"){
    cout << 4 << endl;
    return 0;
  } else if(s == "THU"){
    cout << 3 << endl;
    return 0;
  } else if(s == "FRI"){
    cout << 2 << endl;
    return 0;
  } else if(s == "SAT"){
    cout << 1 << endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
let () =
  let a = Scanf.scanf "%d" (fun n -> Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))) in
  let sum = Array.fold_left (fun acc x -> acc + x ) 0 a in
  let max = Array.fold_left (fun acc x -> if acc > x then acc else x) 0 a in 
  let res = sum - max in
  if res > max then print_endline "Yes" else print_endline "No"


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,T,min=100000000;
	cin>>N>>T;
	int c[N],t[N];
	for (int i=1;i<=N;i++)
	{
		cin>>c[i]>>t[i];
		if (t[i]<=T && c[i]<min)
		{
			min=c[i];
		}
	}
	if (min==100000000)
	{
		cout<<"TLE"<<endl;
		return 0; 
	}
	cout<<min<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a1[100005]={0};
int main(){
	int n;
	cin >> n;
	int a[n]={0};
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		a1[a[i]-1]++;
		a1[a[i]]++;
		a1[a[i]+1]++;
	}
	int maxn=0;
	for(int i=1;i<100000;i++){
		maxn=max(maxn,a1[i]);
	}
	cout << maxn << endl;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n,m;
    cin >> n >> m;
    if(n==0) return 0;
    vector<vector<int>> e(n);
    int u,v;
    rep(i,m){
      cin >> u >> v;
      e[u-1].push_back(v-1);
      e[v-1].push_back(u-1);
    }
    queue<int> q;
    vector<int> c(n,-1);
    c[0]=0;
    q.push(0);
    bool ok=true;
    while(!q.empty()){
      int now=q.front();
      q.pop();
      for(auto nx:e[now]){
        if(c[nx]==-1){
          c[nx]=1-c[now];
          q.push(nx);
        }else{
          if(c[nx]==c[now]){
            ok=false;
            goto next;
          }
        }
      }
    }
    next:;
    if(ok){
      set<int> ans;
      int a=0,b=0;
      rep(i,n){
        if(c[i]) a++;
        else b++;
      }
      if(a%2==0) ans.insert(a/2);
      if(b%2==0) ans.insert(b/2);
      cout << ans.size() << endl;
      for(auto x:ans) cout << x << endl;
    }else{
      cout << 0 << endl;
    }
  }
  return 0;
}



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

int main(){
double N,K;
cin >> N >> K;
vector <double> a;
double res=0;
for(int i=1;i<N+1;i++){
	if(i<K){
	a.push_back(ceil(log2(K/i)));
	}else{
	a.push_back(0);
	}
}
for(int i=0;i<N;i++){
	res+=1.0/(double)pow(2,a[i]);
}
printf("%.10f\n",(double)res/(double)N);
}

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

int main() {
	int a , b ;
	cin>>a>>b;
	if(a % 2 == 0 || b % 2 == 0){
		cout<<"No";
		return 0;
	}
	int st = min(a,b),end =max(a,b);
	for(int i =  st ; i <= end ; ++i ){
		if((a*b*i)%2!=0)
		 {
			cout<<"Yes";
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, long long M, std::vector<long long> s, std::vector<long long> c){
  vector<ll>ans(N,-1);
  REP(M){
    ll tmp=s[i]-1;
    if(ans[tmp]==-1||ans[tmp]==c[i])
      ans[tmp]=c[i];
    else
    {
      cout<<-1<<endl;
      return;
    }
  }
  if(ans.front()==0&&N>1){
    cout<<-1<<endl;
    return;
  }
  REP(N){
    if(ans[i]==-1){
      if(i==0&&N>1){
        ans[i]=1;
      }else{
        ans[i]=0;
      }
    }
    cout<<ans[i];
  }
  cout<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> s(M);
    std::vector<long long> c(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&s[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, M, std::move(s), std::move(c));
    return 0;
}


Measured memory_bytes: 256
A, B, C = map(int, input().split())


def canExistRegularTriangle(A, B, C):
    return (A == B) and (B == C) and (C == A)


def printAbleToExistRegularTriangle(A, B, C):
    if canExistRegularTriangle(A, B, C):
        print("Yes")
    else:
        print("No")


printAbleToExistRegularTriangle(A, B, C)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    in>>n;
    if(n==2) return cout<<-1<<endl,0;
    if(n==3) return puts("aa.\n..a\n..a"),0;
    vector<string> q={"aabc","ddbc","bcaa","bcdd"},
            p={"aabbc","cdd.c","c..ba","a..ba","accdd"},
            h={".llkkj","iihh.j","ggfe..","..fedd","c...ba","c...ba"},
            s={".nnmmll","kkjji..","hhggi..","f....ed","f....ed","....cba","....cba"};
    vector<vector<char>> ans(n,vector<char>(n,'.'));
    fr(i,n/4){
        fr(I,4) fr(J,4){
            ans[4*i+I][4*i+J]=q[I][J];
        }
    }
    if(n%4==1) fr(i,5) fr(j,5) ans[n-5+i][n-5+j]=p[i][j];
    if(n%4==2) fr(i,6) fr(j,6) ans[n-6+i][n-6+j]=h[i][j];
    if(n%4==3) fr(i,7) fr(j,7) ans[n-7+i][n-7+j]=s[i][j];
    fr(i,n){
        fr(j,n) cout<<ans[i][j];
        cout<<endl;
    }
}

Measured memory_bytes: 2304
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl

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

#define ynmes(a) (a) ? mes("Yes") : mes("No")
#define YNmes(a) (a) ? mes("YES") : mes("NO")
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void)
{    
    string s;
    cin >> s;
    bool flg = false;
    rep(i, 2) {
        if(s[i] == '9') flg = true;
    }
    ynmes(flg);
	
    
    
    
    
    
    
    
}



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

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    if(A < 10 && B < 10){
        cout << A * B << endl;
    }else{
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int[] a = new int[N+1];
        a[0] = 1;

        int DIV = (int)1e9 + 7;

        for(int i=0; i<M; i++){
            int tmp = scanner.nextInt();
            a[tmp] = -1;
        }

        for(int i=0; i<N; i++){
            if(i+1 == N){
                if(a[i] != -1 && a[i+1]!=-1){
                    a[i+1] += a[i];
                    a[i+1] %= DIV;
                }
            }else{
                // one
                if(a[i+1] != -1 && a[i] != -1){
                    a[i+1] += a[i];
                    a[i+1] %= DIV;
                }
                // two
                if(a[i+2] != -1 && a[i] != -1){
                    a[i+2] += a[i];
                    a[i+2] %= DIV;
                }
            }
        }

        System.out.println(a[N]);
    }
}


Measured memory_bytes: 50440
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using ld = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<double> p(N);
  INPUT(p);
  vector<vector<double>> dp(N+1, vector<double>(N+1, 0));
  dp[0][0] = 1;
  REP2(i, 1, N+1) REP(j, N+1)
  {
    if (j > i) continue;
    if (j == 0) dp[i][j] = dp[i-1][j] * (1-p[i-1]);
    else dp[i][j] = dp[i-1][j] * (1-p[i-1]) + dp[i-1][j-1] * p[i-1];
  }
  double ans = 0;
  REP2(i, N/2+1, N+1) ans += dp[N][i];
  cout << setpre(10) << ans << endl;

  return 0;
}

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

int main(void) {
	string S;
	cin >> S;

	string ans = "No";
	for (int i = 0; i < 3; ++i) {
		if (S[i] == '7') {
			ans = "Yes";
			break;
		}
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3632
#include <cstdio>

using namespace std;
int d[32];
int main(){

	for(int i = 0;i < 28;i++){
		int t;
		scanf("%d",&t);

		d[t] = 1;
	}

	for(int i = 1;i <= 30;i++){
		if(d[i] != 1){
			printf("%d\n",i);
		}
	}

	return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 998244353;

ll rep_pow(int n, int p) { // n^p
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        ll t = rep_pow(n, p / 2);
        return t * t % MOD;
    } else {
        return n * rep_pow(n, p - 1) % MOD;
    }
}

int main() {
    ll n, m, k; cin >> n >> m >> k;
    vector<ll> coef(k + 1);
    ll cur = 1;
    for (int i = 0; i <= k; i++) {
        coef[i] = cur % MOD;
        cur = cur * (n - 1 - i) % MOD * rep_pow(i + 1, MOD - 2) % MOD;
    }
    ll ans = 0;
    for (int i = 0; i <= min(k, n); i++) {
        ans += coef[i] * rep_pow(m - 1, n - 1 - i) % MOD;
        ans %= MOD;
    }
    cout << ans * m % MOD;
    return 0;
}


Measured memory_bytes: 4840
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
// https://atcoder.jp/contests/abc173/tasks/abc173_f
ll mod = 1e9+7;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll n;
    cin >> n;
    vector<pll> v(n);
    for(int i = 0;i<n-1;i++){
        cin >> v[i].first >> v[i].second;
    }
    ll ans = 0;
    for(int i = 1;i<=n;i++){
        ans += i * (n-i+1);
    }
    for(int i = 0;i<n-1;i++){
        ll a = v[i].first;
        ll b = v[i].second;
        if(a > b) swap(a,b);
        ans -= (a * (n-b+1));
    }
    cout << ans;

	return 0;
}


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

int main(){
    int m,n,x,mab = 1000;
    cin >> n;
    cin >> x;
    for(int i = 1;i <= n;i++){
        cin >> m;
        x = x - m;
        if(mab > m) mab = m;
    }
    
    cout << (x / mab) + n << endl;
    return 0;
}

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

#include <algorithm>
#include <queue>
#include <cctype>
#include <numeric>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define debugos cerr
#define debug(v) do {debugos << "L" << __LINE__ << " " << #v << " > ";debugos<<(v)<<newl;} while (0)
#define debugv(v) do {debugos << "L" << __LINE__ << " " << #v << " > ";for(auto e:(v)){debugos<<e<<" ";}debugos<<newl;} while (0)
#define debuga(m,w) do {debugos << "L" << __LINE__ << " " << #m << " > ";for(int x=0;x<(w);x++){debugos<<(m)[x]<<" ";}debugos<<newl;} while (0)
#define debugaa(m,h,w) do {debugos << "L" << __LINE__ << " " << #m << " > \n";for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){debugos<<(m)[y][x]<<" ";}debugos<<newl;}} while (0)

string S;
string ss[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
int ans;
int main() {
    cin >> S;
    rep(i,7) {
        if (S == ss[i]) {
            ans = i;
        }
    }
    cout << 7 - ans << '\n';
}

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

int main() {
	int H, W, A, B;
	scanf("%d%d%d%d", &H, &W, &A, &B);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++)
			printf("%d", (i < B) ^ (j < A));
		puts("");
	}
	return 0;
}

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

#define ll long long
const int mod = 1e9 + 7;


int n;
int arr[105];
ll int dp[105][100005];
ll int psum[105][100005];

int kil(int idx, int kleft)
{
  if(idx == n)
  {
    if(kleft == 0)
      return 1;
    return 0;
  }
  if(dp[idx][kleft] != -1)
    return dp[idx][kleft];

  dp[idx][kleft] = 0;
  for(int i=0;i<=min(arr[idx], kleft);i++)
    dp[idx][kleft] += kil(idx+1, kleft-i);

  return dp[idx][kleft];
}

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

  memset(dp, -1, sizeof dp);

  int k, res;
  cin>>n>>k;
  for(int i=0;i<n;i++)
    cin>>arr[i];



  // iterative
  memset(dp, 0, sizeof dp);
  dp[n][0] = 1;

  for(int kleft = 0; kleft <= k; kleft ++)
    psum[n][kleft] = ((kleft > 0) ? psum[n][kleft - 1] : 0) + dp[n][kleft];

  for(int idx = n-1; idx>=0; idx--)
  {
    for(int kleft = 0; kleft <= k; kleft ++)
    {
      // for(int i=0;i<=min(arr[idx], kleft);i++)
      //   dp[idx][kleft] += dp[idx+1][kleft-i];
      //   // sum  dp[kleft] + dp[kleft-1] + dp[kleft-2] .... dp[kleft-min(arr[idx], kleft)]
      //   // dp[k] .... dp[0]
      int y = min(arr[idx], kleft);
      dp[idx][kleft] = (psum[idx+1][kleft] + mod - ((kleft - y) > 0 ? psum[idx+1][kleft - y -1] : 0)) % mod;
      psum[idx][kleft] = (((kleft > 0) ? psum[idx][kleft - 1] : 0) + dp[idx][kleft]) % mod;
    }
  }

  // cout<<kil(0, k)<<endl;
  cout<<dp[0][k]<<endl;

  return 0;
}


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

typedef long long ll;

int main () {

    ll N;
    cin >> N;
    vector<ll> a(N),b(N);
    for(int i=0; i<N; i++) {
	cin >> a[i] >> b[i];
    }
    ll push = 0;
    for(int i=N-1; i>=0; i--) {
	push += ( ceil(((double)a[i]+push) / b[i]) * b[i] ) - (a[i] + push);
    }
    cout << push << endl;
    return 0;
}


Measured memory_bytes: 1792
#N,X,T
N, X, T = gets.chomp.split(" ").map(&:to_i)

if N/X>=1 && N%X != 0
  count=N/X+1
  time = T*count
elsif N/X>=1 && N%X == 0
  count = N/X
  time = T*count
else
  time = T
end


print("#{time}")

Measured memory_bytes: 14172
N,L=map(int,input().split())
Aji=[0]*N
Sum=0
AjiMin=10**9
EatApple=0
for i in range(N):
  if i==0:
    Aji[i]=L
  else:
    Aji[i]=Aji[i-1]+1
  Sum+=Aji[i]
  AbsVal=abs(Aji[i])
  if AbsVal<AjiMin:
    AjiMin=AbsVal
    EatApple=Aji[i]
print(Sum-EatApple)


Measured memory_bytes: 3064
x=int(input())

import math
import bisect
#----エラトステネスの篩--------
def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list
  
s=get_primenumber(100500)

i = bisect.bisect_left(s, x)

print(s[i])

Measured memory_bytes: 13292
import std.algorithm;
import std.array;
import std.bigint;
import std.bitmanip;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

// 差の絶対値
@nogc @safe pure T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

// 切り上げ除算
@nogc @safe pure T divCeil(T)(const ref T a, const ref T b) {
    return (a+b-1)/b;
}

T[] readToArray(T)() {
    return readln.split.to!(T[]);
}

void readInto(T...)(ref T ts) {
    auto ss = readln.split;
    foreach(ref t; ts) {
        t = ss.front.to!(typeof(t));
        ss.popFront;
    }
}

// 冪乗をmod取りつつ計算
@nogc @safe pure ulong modPow(ulong a, ulong n, ulong m) {
    ulong r = 1;
    while (n > 0) {
        if(n % 2 != 0) r = r * a % m;
        a = a * a % m;
        n /= 2;
    }
    return r;
}

// フェルマーの小定理から乗法逆元を計算
// 定理の要請により法は素数
@nogc @safe pure ulong modInv(ulong a, ulong m) {
    return modPow(a, m-2, m);
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modPerm(ulong n, ulong k, ulong m) {
    if (n < k) return 0;

    ulong r = 1;
    for (ulong i = n-k+1; i <= n; i++) {
        r *= i;
        r %= m;
    }
    return r;
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modFact(ulong n, ulong m) {
    return modPerm(n, n, m);
}

// mod取りつつ組み合わせを計算
// modInvを使っているので法は素数
@nogc @safe pure ulong modComb(ulong n, ulong r, ulong m) {
    return modPerm(n, r, m)*modInv(modFact(r, m), m) % m;
}

immutable ulong MOD = 1000000007;

void main() {
    ulong a;
    string s;
    readInto(a);
    readInto(s);
    if (a < 3200) writeln("red");
    else writeln(s);
}


Measured memory_bytes: 256
n, m = map(int,(input().split()))
A_list = [list(map(int,input().split()))for i in range(n)]
B_list =[]    
for j in range(m):
    B_list.append(int(input()))       
ant_list =[]      
for k in range(n): 
    y = 0
    for l in range(m):
        x = A_list[k][l] * B_list[l]
        y += x
    print(y)
    


Measured memory_bytes: 6016
using System;
class program{
  static void Main(string[] args){
    program p = new program();
    p.Run();
  }
  void Run(){
	string[] inp=Console.ReadLine().Split();
    int H = int.Parse(inp[0]);
    int W = int.Parse(inp[1]);
	inp=Console.ReadLine().Split();
    int h = int.Parse(inp[0]);
    int w = int.Parse(inp[1]);
    int r = (H-h)*(W-w);
    Console.WriteLine(r.ToString());
  }
}




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

int main(){
  string str, str1, str2;
  int m, h;

  while(1){
    cin >> str;
    if ( str == "-" ) break;

    cin >> m;
    for ( int i = 0; i < m; i++ ){
      cin >> h;
      str1 = str.substr(0, h);
      str2 = str.substr(h, str.size()-h);
      str = str2 + str1;
    }

    cout << str << endl;
  }

  return 0;
}


Measured memory_bytes: 3156
from itertools import permutations
n, m = map(int, input().split())
d = [[] for _ in range(n)]
ans = 0
for i in range(m):
  a, b = map(int, input().split())
  d[a - 1].append(b - 1)
  d[b - 1].append(a - 1)
l = permutations(range(1, n))
for i in l:
  pre = 0
  c = 0
  for j in i:
    if not j in d[pre]:
      break
    c += 1
    pre = j
  if c == n-1:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
    using namespace std;
     
    vector<int> g[200001];
    int main()  {
        int n, m;
        cin >> n >> m;
     
        for(int i=0; i<m; ++i) {
            int a, b;
            cin >> a >> b;
            g[a].push_back(b);
        }
     
        int ans = false;
        for(int i=0; i<g[1].size(); ++i) {
            int t = g[1][i];
            if(find(g[t].begin(), g[t].end(), n)!=g[t].end()) {
                ans = true;
                break;
            }
        }
        if(ans) cout << "POSSIBLE" << endl;
        else cout << "IMPOSSIBLE" << endl;
        return 0;
    }

Measured memory_bytes: 8576
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();

        int[] C = new int[N];
        int[][] A = new int[N][M];

        for(int i = 0 ; i < N ; i++){
            C[i] = sc.nextInt();
            for(int j = 0 ; j < M ; j++){
                A[i][j] = sc.nextInt();
            }
        }

        int costMin = (int)1e8;
        for(int k = 0 ; k < (1 << N) ; k++){
            int[] rikai = new int[M];
            int cost = 0;
            for(int i = 0 ; i < N ; i++){
                if((k & (1 << i)) > 0){
                    for(int j = 0 ; j < M ; j++){
                        rikai[j] += A[i][j];
                    }
                    cost += C[i];
                }
            }
            int rikaiMin = X;
            for(int j = 0 ; j < M ; j++){
                rikaiMin = Math.min(rikaiMin, rikai[j]);
            }
            if(rikaiMin == X) {
                costMin = Math.min(cost, costMin);
            }
        }

        if(costMin == (int)1e8){
            costMin = -1;
        }
        System.out.println(costMin);
    }
}


Measured memory_bytes: 37512
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    v=list(map(int,readline().split()))

    cnt1=[0]*(10**5+1)
    cnt2=[0]*(10**5+1)

    for i in range(n):
        if i%2==0:
            cnt1[v[i]]+=1
        else:
            cnt2[v[i]]+=1

    max1=0
    m=0
    for i in range(1,10**5+1):
        if max1<cnt1[i]:
            max1=cnt1[i]
            m=i
    
    max2=0
    l=0
    for i in range(1,10**5+1):
        if max2<cnt2[i]:
            if i!=m:
                max2=cnt2[i]
                l=i

    max3=0
    o=0
    for i in range(1,10**5+1):
        if max3<cnt2[i]:
            max3=cnt2[i]
            o=i

    max4=0
    p=0
    for i in range(1,10**5+1):
        if max4<cnt1[i]:
            if i!=o:
                max4=cnt1[i]
                p=i

    ans=min(n-max1-max2,n-max3-max4)
    print(ans)

if __name__=="__main__":
    main()

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast



    int n;
    cin>>n;

    int maxi = 0;

    int k;
    ll sum = 0;
    forn(i,0,n)
    {
        cin>>k;
        sum += k;
        maxi = max(maxi,k);
    }

    sum -= maxi/2;

    cout<<sum;

    return 0;
}

Measured memory_bytes: 256
def f(a):
	s=0;q=a[:n];s=sum(q);heapify(q);r=[s]
	for i in range(n,2*n):s=s+a[i]-heappushpop(q,a[i]);r+=[s]
	return r
import sys;from heapq import*;n,*a=list(map(int,sys.stdin.read().split()));print(max(map(sum,zip(f(a),list(reversed(f(list(reversed([-e for e in a])))))))))

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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(a: int, b: int, c: int, d: int):
    if abs(c - a) <= d or abs(b - a) <= d and abs(c - b) <= d:
        ret = YES
    else:
        ret = NO
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    d = int(next(tokens))  # type: int
    solve(a, b, c, d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int main() {
  ios::sync_with_stdio(false);
  char a;
  cin>>a;
  if(a=='z')cout<<'a'<<endl;
  else cout<<++a;
  return 0;
}


Measured memory_bytes: 256
/* created   : 2019-11-09 20:08:09
 * accepted  : 2019-11-09 20:42:22
 * author    : landcold7
 */
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mt make_tuple
#ifndef LOCAL
#define trace(...)
#endif
typedef long long ll;

const int mod = 998244353;

inline int mul(int a, int b) {
  return (int) ((long long) a * b % mod);
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

void solve() {
  int n; cin >> n;
  const int N = 1e5 + 7;
  vector<int> cnt(N);
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    if (i == 0 && x != 0) {
      cout << 0 << '\n';
      return;
    }
    cnt[x]++;
  }
  // assert(cnt[0] == 1);
  if (cnt[0] != 1) {
    cout << 0 << '\n';
    return;
  }
  int ans = 1;
  for (int i = 1; i < N; i++) {
    int cur = cnt[i];
    int last = cnt[i - 1];
    if (cur > 0 && last > 0) {
      ans = mul(ans, power(last, cur));
    }
    if (cur > 0 && last == 0) {
      cout << 0 << '\n';
      return;
    }
  }
  cout << ans << '\n';
}

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define mk make_pair
#define ll long long
using namespace std;
const int N = 3e5 + 5;
const int mod = 1e9 + 7;
int n, a[N];
map<int, int> M;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		M[a[i]]++;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		if (M[a[i]] == 0) continue;
		int tmp = M[a[i]];
		if (tmp >= a[i])
			ans += tmp - a[i];
		else 
			ans += tmp;
		M[a[i]] = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long n,m,p=0,a=0,x;
    string s;
    cin>>n>>m;
    unordered_map<int,int> mp,mp1;
    while(m--)
    {
        cin>>x>>s;
        if(s=="AC")
        {
            if(mp[x]==0){
            a++;
            p+=mp1[x];
            }
            mp[x]=1;
           
        }
        else
        {
            if(mp[x]==0)
            mp1[x]++;
        }
    }
    cout<<a<<" "<<p;
    return 0;
}


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

namespace BeginnerCont90
{
    class Program
    {
        static void Main(string[] args)
        {
            var l1 = Console.ReadLine().Split();
            var a = int.Parse(l1[0]);
            var b = int.Parse(l1[1]);
            var num = 0;
            for(int n = a; n <= b; n++)
            {
                var p1 = n / 10000;
                var p2 = (n % 10000) / 1000;
                var p3 = (n % 1000) / 100;
                var p4 = (n % 100) / 10;
                var p5 = n % 10;
                if (p1 == p5 && p2 == p4)
                {
                    num++;
                }
            }
            Console.WriteLine(num.ToString());
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long ll;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(void){
  int N;
  cin>>N;

  N/=100;
  cout<<"ai1333";
  REP(i,N){
     cout<<"3";
  }
  cout<<endl;
  return 0;


}



Measured memory_bytes: 3088
arr=[]
for i in range(3):
  a,b=map(int,input().split())
  arr.append(a)
  arr.append(b)
if arr.count(1)==3 or arr.count(2)==3 or arr.count(3)==3 or arr.count(4)==3:
  print('NO')
else:
  print('YES')

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int size = n + 1;
    	long[][] comb = new long[size][size];
    	for (int i = 0; i < size; i++) {
    	    for (int j = 0; j <= i; j++) {
    	        if (j == 0 || j == i) {
    	            comb[i][j] = 1;
    	        } else {
    	            comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
    	        }
    	    }
    	}
    	long ans = 0;
    	for (int i = 1; i * 3 <= n; i++) {
    	    int count = n - i * 3;
    	    ans += comb[count + i - 1][count];
    	    ans %= MOD;
    	}
	    System.out.println(ans);
	}
}

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

int main(void)
{
	int a, b;
	while( fscanf(stdin,"%d %d\n",&a,&b) >= 0 )
	{
		printf( "%d\n", (a+b==0)? 1:((int)log10(a+b)+1) );
	}
	
	return 0;
}

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

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> h(n+1);
        for(int i=0; i<n+1; ++i)
            cin >> h[i];

        for(int i=0; ; ++i){
            vector<int> h2 = h;
            h2.erase(h2.begin() + i);
            
            vector<int> d(n-1);
            for(int i=0; i<n-1; ++i)
                d[i] = h2[i+1] - h2[i];
                
            if(d == vector<int>(d.size(), d[1])){
                cout << h[i] << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3148
#include <iostream>
using namespace std;
int N,mn,mx;
int A[9999999];

int main(){
    cin >> N;
    for (int j = 0; j < N; j++) cin >> A[j];
    mn=A[0],mx=A[0];
    for(int i=1;i<N;i++){
		if(mn>A[i])mn=A[i];
		if(mx<A[i])mx=A[i];
    }
    cout <<    mx-mn << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  int ans = n - i + 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256