akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int n;
  cin>>n; 

  vector<ll> p(n);
  vector<int> q(100005);
  rep(i,n){
    cin>>p[i];
    q[p[i]+1]++;
  }

  int ans=0;
  rep(i,100002){
    chmax(ans,q[i]+q[i+1]+q[i+2]);
  }

  cout << ans << endl;
}

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

int main() {
    int X , Y , Z , T;
    cin >> X >> Y >> Z; //1 ≤ X,Y,Z ≤ 100
    T = X ;
    X = Y ;
    Y = T ; 
    T = X ;
    X = Z ;
    Z = T ;
    cout << X << " " << Y << " " << Z << endl;
	return 0;
}

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

int a[60]={0};
long long dp[60];

int main()
{
	int n;
	cin >> n;
	string s, s2;
	cin >> s >> s2;
	a[1] = 1;
	int t = 1;
	for(int i=1; i<s.length(); i++)
	{
		if(s[i]!=s[i-1])
			a[++t]++;
		else
			a[t]++;
	}
	if(a[1]==1)
		dp[1] = 3;
	else
		dp[1] = 6;
	for(int i=2; i<=t; i++)
	{
		if(a[i-1]==2)
		{
			if(a[i]==1)
				dp[i] = dp[i-1];
			else
				dp[i] = dp[i-1]*3%1000000007;
		}
		else
			dp[i] = dp[i-1]*2%1000000007;
	}
	cout << dp[t] << endl;
}

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

int main() {
	int h, w;
    cin >> h >> w;
    vector<string> grid(h);
    for (int i = 0; i < h; ++i) {
        cin >> grid[i];
    }

    mcf_graph<int, int> P(h * w + 2);
    int s = h * w, t = h * w + 1;
    int fst = 0, cnt = 0;
    const int inf = 1e5;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if(grid[i][j] == 'o') {
                P.add_edge(s, i * w + j, 1, 0);
                fst += i + j;
                cnt++;
            }
            if(grid[i][j] != '#') {
                for (int d = 0; d < 2; ++d) {
                    int x = i + d, y = j + (d ^ 1);
                    if(x >= h || y >= w) continue;
                    if(grid[x][y] == '#') continue;
                    P.add_edge(i * w + j, x * w + y, h * w, 0);
                }
                P.add_edge(i * w + j, t, 1, inf - (i + j));
            }
        }
    }
    int lst = P.flow(s, t).second;
    cout << inf * cnt - lst - fst << endl;
}


Measured memory_bytes: 4104
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp
    
    r = x % y
    while r != 0:
        x = y
        y = r
        r = x % y

    return y


x, y = map(int, input().split())
print(gcd(x, y))


Measured memory_bytes: 5600
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public class Restaurant{
		int point = 0 ;
		String city = "" ;
		int No = 0 ;
		public int getPoint() {
			return point;
		}
		public void setPoint(int point) {
			this.point = point;
		}
		public String getCity() {
			return city;
		}
		public void setCity(String city) {
			this.city = city;
		}
		public int getNo() {
			return No;
		}
		public void setNo(int no) {
			No = no;
		}

	}

	public static void main(String[] args) {
		(new Main()).execute();
	}
	public void execute() { ;
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		Restaurant restaurants[] = new Restaurant[N];
//		List<Restaurant> list = new ArrayList<Restaurant>() ;
//		String S[] = new String[N];
//		int P[] = new int[N];

		Comparator c = new Comparator<Restaurant>() {
            @Override
            public int compare(Restaurant obj1, Restaurant obj2) {
            	int cmp = obj1.getCity().compareTo(obj2.getCity()) ;
            	if(cmp != 0 ) {
            		return cmp ;
            	}
                return obj2.getPoint() - obj1.getPoint();
            }
        };
		for(int i = 0 ; i < N ; i ++) {
			restaurants[i] = this.new Restaurant() ;
			restaurants[i].setCity(sc.next());
			restaurants[i].setPoint(sc.nextInt());
			restaurants[i].setNo(i + 1);
//			list.add(restaurants[i]) ;
		}
		Arrays.sort(restaurants,c);
//		System.out.println("N=" + N);
//		for(int i = 0 ; i < N ; i ++) {
			//System.out.println("S[" + (i+1) + "]=" + restaurants[i].getCity() + ",P[" + (i+1) + "]=" + restaurants[i].getPoint());
//			restaurants[i].setPage(i+1);
//		}
		for(int i = 0 ; i < N ; i ++) {
			System.out.println(restaurants[i].getNo());
		}

		// 出力
		//System.out.println(pi);

	}

}


Measured memory_bytes: 21844
/* author   : mpily :-()
title : Competing1.cpp
time :Sun Jan 19 14:54:36 2020

*/
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int dp[10][10];
	for(int i = 0; i < 10; i++)
		for(int j = 0; j < 10; j++)dp[i][j] = 0;
	for(int i = 1; i <= n; i++){
		int ld = i%10;
		int lg = log10(i); 
		int fd = i/pow(10,lg);
		dp[fd][ld]+=1;
		
	}
	long long ans = 0;
	for(int i = 1; i < 10; i++){
		for(int j = 1; j < 10; j++){
			ans+=(dp[i][j]*dp[j][i]);
			//if(i==j)ans-=dp[i][j];
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {


    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        long D = in.nextLong();
        long A = in.nextLong();
        long[] x = new long[n];
        long[] h = new long[n];
        Point[] points = new Point[n];
        for (int i = 0; i < n; i++) {
            x[i] = in.nextLong();
            h[i] = in.nextLong();
            h[i] = (h[i] + A - 1) / A;
            points[i] = new Point(x[i], h[i]);
        }
        Arrays.sort(points);
        int[] l = new int[n];
        int[] r = new int[n];
        int end = 0;
        for (int i = 0; i < n; i++) {
            while (end < n && points[end].x <= points[i].x + 2 * D) {
                end++;
            }
            l[i] = i;
            r[i] = end;
        }
        long[] a = new long[n + 1];
        Arrays.fill(a, 0);
        //for (int i = 0; i < n; i++) {
        //    a[l[i]] += h[i];
        //    a[r[i]] -= h[i];
        //}
        long ans = 0, cur = 0;
        for (int i = 0; i < n; i++) {
            cur += a[i];
            long H = points[i].h;
            if (cur < H) {
                a[l[i]] += H - cur;
                a[r[i]] -= H - cur;
                ans += H - cur;
                cur = H;
            }
        }
        out.println(ans);
    }

    class Point implements Comparable<Point> {
        long x;
        long h;

        public Point(long x, long h) {
            this.x = x;
            this.h = h;
        }

        public int compareTo(Point o) {
            return x < o.x ? -1 : 1;
        }
    }


}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer      tokenizer;

    public InputReader(InputStream stream){
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

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

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

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

}


Measured memory_bytes: 69500
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
#include <set>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

ll N,T;
ll t[200100];

int main(){
	cin>>N>>T;
	REP(i,N)
		cin>>t[i];
	ll s=0;
	ll ans=0;
	for(int i=1;i<N;i++){
		if(t[i-1]+T<t[i]){
			ans+=T+t[i-1]-s;
			s=t[i];
		}else if(i==N-1){
			ans+=t[i]-s;
		}
	}
	cout<<ans+T<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a, b) << '\n';
 	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline

A, B, = map(int, input().split())

def f(n):
    if n % 100 == 0:
        return f(n // 100) + 1
    else:
        return 0

c = 0
for i in range(1, 2000001):
    if A == f(i):
        c += 1

    if c == B:
        print(i)
        exit()

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
  
#define NMAX 100
  
int bs (int [], int, int);
  
int compar (const void *a, const void *b) {
  return *(int *)a- *(int *)b;
}
  
int main(void)
{
  while(1)
  {
    int i,n,m,A[NMAX],B[NMAX],Asum=0,Bsum=0,S,D,a,b,k;
    scanf("%d%d",&n,&m);
    if(n==0 && m==0) break;
    for(i=0;i<=n-1;i++)
    {
        scanf("%d",&A[i]);
		Asum+=A[i];
    }
    for(i=0;i<=m-1;i++)
	{
		scanf("%d",&B[i]);
		Bsum+=B[i];
	}
	qsort(B,m,sizeof(int),compar);
	S=1000;
	k=-1;
	for(i=0;i<=n-1;i++)
	{
		D=Bsum-Asum+2*A[i];
		if(D%2==0)
		{
			D=D/2;
			if(bs(B,m,D)!=-1 && S>A[i]+bs(B,m,D))
			{
				S=A[i]+bs(B,m,D);
				a=A[i];
				b=bs(B,m,D);
				k=0;
			}
		}
	}
	if(k==0)
	{
	    printf("%d %d\n",a,b);
	}
	else
	{
		printf("-1\n");
	}
  }
  return 0;
}
  
 int bs (int D[], int n, int c) 
 {
    int j,k,l;
    j=0;
    k=n-1;
    while(1)
    {
        if(j<=k)
        {
            l=(j+k)/2;
            if(D[l] > c)
            {
                k=l-1;
            }
            else if(D[l] < c)
            {
                j=l+1;
            }
            else
            {
                return D[l];
            }
        }
        else
        {
            return -1;
        }
    }
}

Measured memory_bytes: 616
//containing t test cases
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define scan(n) ll a[n]; for(ll i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define rep(i,x,y) for(ll i=x;i<y;i++)
//#define int long long
using namespace std;
typedef vector<int>vi ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ; 
typedef pair<ll,ll> pll ;
typedef vector<pair<ll,ll> > vpll;
/*vi adj[200005];
ll vis[200005];
ll parent[200005];
ll level[200005];
ll arr[200005];
ll size[200005];*/
//endl mut bhool!!
int main()
{
	fast;
	int test=1;
	//cin>>test;
	while(test--)
	{
		ll a,b,n,x;
		cin>>a>>b>>n;
		ll flag=0;
		ll y=n%b;
		x=n-y-1;
		if(x<=0)
		{
			x=n;
		}
		cout<<floor((a*x)/b)-a*floor(x/b);
	}
	return 0;
}
/*
cout<<"YES"<<endl;
cout<<"NO"<<endl;
*/



Measured memory_bytes: 3788
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <cstring>
#include <vector>
#include <queue>
#include <iomanip>
#include <stack>
#include <set>
#include <iterator>
#include <queue>

using namespace std;
typedef long long ll;

ll ans, mx, sum,flag, mn = 1e14, cnt;


int main(){
	ll n;
	cin>>n;
	for(ll i=1; i<=n; i++){
		ans +=i;
		if(ans>=n) {
			flag=i;
			break;
		}
		
	}
	if(ans>n){
		ll g=ans-n;
		for(ll i=1; i<=flag; i++){
			if(i!=g) cout<<i<<endl;
		}
	}
	else {
		for(ll i=1; i<=flag; i++){
			cout<<i<<endl;
		}
	}
}

Measured memory_bytes: 3604
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{ 
    static void Main(string[]args)
    {
        Magatro alice = new Magatro();
        alice.Scan();
        alice.Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;
    private string[] S;
    private int Index;
    private const char Separator = ' ';
    public Scanner()
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(Console.OpenStandardInput());
    }
    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }
    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private int x;
    public void Scan()
    {
        Scanner sc = new Scanner();
        x = sc.NextInt();
    }

    public void Solve()
    {
        Console.WriteLine(x < 1200 ? "ABC" : "ARC");
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define N 210
int n, a[N];
vector<int> A;

void rot(int k) {
	if (k == 0) return;
	A.pb(k);
	for (int i = k; i < n; i ++) swap(a[i], a[i-k]);
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i ++) cin >> a[i];
	while (true) {
		bool F = false;
		for (int i = 0; i < n; i ++) {
			if (a[0] != 0 && a[n-1] > a[0]) {
				F = true;
				rot(n-1);
			}
			rot(1);
		}
		if (!F) break;
	}
	while (a[0] != 0) rot(1);
	printf ("%d\n", (int) A.size());
	for (int i = 0; i < (int) A.size(); i ++)
		cout << A[i] << endl;
	for (int i = 0; i < n; i ++) assert(a[i] == i);
	return 0;
}

Measured memory_bytes: 768
import itertools

N,K = map(int,input().split())
A = list(map(int,input().split()))

for i in range(K):
    TEMP = [0]*(N+1)
    for j in range(N):
        TEMP[max(0,j-A[j])] +=1
        TEMP[min(N,j+A[j]+1)] -=1
    A = list(itertools.accumulate(TEMP))
    if A[0] == N and A[N-1] == N:
        break

A.pop()
print(*A)

Measured memory_bytes: 195496
"use strict"
// inputに入力データ全体が入る
function Main(input){
    let sum = 0;
    input = input.split(" ").map(e=>parseInt(e)).sort((a, b)=>a<b ? 1 : -1);
    let topvalue = input.shift();
    for(let val of input){
        sum += topvalue - val;
        topvalue = val;
    }
    console.log(sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define REP(i,n)    for(int i = 0; i < (int)n; i++)
#define MAX_N   100000
typedef long long ll;

void solve(){
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a * n, b) << endl;

}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))
 
calculator = 0
pluc_index = 0
minus_index = -1
for i in range(N):
    if calculator <= 0:
        calculator += A_list[pluc_index]
        pluc_index += 1
    else:
        calculator -= A_list[minus_index]
        minus_index -= 1
print(abs(calculator))

Measured memory_bytes: 26764
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for (int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
    }

    int cnt = bubbleSort(arr);
    trace(arr);
    System.out.println(cnt);
  }

  static int bubbleSort(int[] arr) {
    int cnt = 0;
    for (int i = 0; i < arr.length - 1; i++) {
      int tmp = 0;
      for (int j = arr.length - 1; j >= i + 1; j--) {
        if (arr[j] < arr[j - 1]) {
          tmp = arr[j];
          arr[j] = arr[j-1];
          arr[j-1] = tmp;
          cnt++;
        }
      }
    }
    return cnt;
  }

  static void trace(int[] arr) {
    StringBuilder sb = new StringBuilder();
    for (int num : arr) {
      sb.append(num).append(' ');
    }
    System.out.println(sb.toString().trim());
  }
}



Measured memory_bytes: 26372
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const int MAXM = 1e5 + 5;
const int MAXD = 1e5 + 5;

int p[MAXN],q[MAXM];
vector<int> a;

int main(void)
{
	int x,y,n,m,d;
	scanf("%d%d%d%d%d",&x,&y,&n,&m,&d);
	for(int i=1; i<=n; ++i) scanf("%d",&p[i]);
	for(int i=1; i<=m; ++i) scanf("%d",&q[i]);
	a.resize(d);
	for(int i=1; i<=d; ++i) scanf("%d",&a[i-1]);
	
	sort(p+1,p+n+1);
	reverse(p+1,p+n+1);
	for(int i=1; i<=x; ++i) a.push_back(p[i]);
	sort(q+1,q+m+1);
	reverse(q+1,q+m+1);
	for(int i=1; i<=y; ++i) a.push_back(q[i]);
	
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	
	ll ans=0;
	for(int i=0; i<x+y; ++i) ans += a[i];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2552
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    

    ll n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    for (ll i=0;i<n;i++){
        cout << s[i] << t[i];
    }
    cout << endl;
}

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

int s[1000], d[1000], t[1000][1000], y[1000];
P p[100001];
int main() {
	int n, m, h, k;
	while (scanf("%d%d%d%d", &n, &m, &h, &k), n) {
		rep(i, n)scanf("%d", &s[i]), d[i] = t[0][i] = i;
		rep(i, m) { int a, b; scanf("%d%d", &a, &b); p[i] = P(b, a); }
		sort(p, p + m);
		int u = 0;
		for (int i = 1; i < h; i++) {
			while (p[u].first == i)swap(d[p[u].second - 1], d[p[u].second]), u++;
			rep(j, n)t[i][j] = d[j];
		}
		rep(i, n)y[d[i]] = i;
		int Min = 0; rep(i, n)if (d[i] < k)Min += s[i];
		rep(i, m) {
			int c = p[i].first - 1, e = p[i].second;
			int a = y[t[c][e - 1]], b = y[t[c][e]];
			swap(d[a], d[b]);
			int sum = 0; rep(i, n)if (d[i] < k)sum += s[i];
			Min = min(Min, sum);
			swap(d[a], d[b]);
		}
		printf("%d\n", Min);
	}
}

Measured memory_bytes: 7892
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 2007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
int Scan() {
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
const int N=100005;
//Code begin...

LL a[N], n, A, B;

bool check(int x){
    LL res=0;
    FOR(i,1,n) {
        LL tmp=a[i]-x*B;
        if (tmp<=0) continue;
        res+=(tmp+A-1)/A;
    }
    return res<=x;
}
int main ()
{
    scanf("%lld%lld%lld",&n,&A,&B);
    A-=B;
    FOR(i,1,n) scanf("%lld",a+i);
    int l=0, r=INF+1, mid;
    while (l<r) {
        mid=(l+r)>>1;
        if (check(mid)) r=mid;
        else l=mid+1;
    }
    printf("%d\n",r);
    return 0;
}


Measured memory_bytes: 1024
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
# L = [LIST() for i in range(N)]

zmax, zmin, wmax, wmin = -10 ** 9, 10 ** 9, -10 ** 9, 10 ** 9
# for i in range(N):
for i in range(N):
    x, y = MAP()
    zmax = max(zmax, x + y)
    zmin = min(zmin, x + y)
    wmax = max(wmax, x - y)
    wmin = min(wmin, x - y)
print(max(zmax - zmin, wmax - wmin))



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

int main()
{
    int n,m;
    cin>>n>>m;
    char arr[n+5][m+5];
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>arr[i][j];
        }
    }
    int frr[n+5][m+5]={0};

    for(int j=1;j<=m;j++)
    {
        int sum=0;
        for(int i=1;i<=n;i++)
        {
            if(arr[i][j]=='#')
            {
                sum=0;
                frr[i][j]=0;
            }
            else
            {
                sum++;
                frr[i][j]=sum;
            }
        }
    }

    for(int j=1;j<=m;j++)
    {
      //  int sum=0;
        for(int i=n;i>=1;i--)
        {
            if(i+1<=n&&frr[i][j]!=0&&frr[i+1][j]!=0)
            {
                frr[i][j]=frr[i+1][j];
            }
        }
    }
   int krr[n+5][m+5]={0};

     for(int i=1;i<=n;i++)
    {
        int sum=0;
        for(int j=1;j<=m;j++)
        {
            if(arr[i][j]=='#')
            {
                sum=0;
                krr[i][j]=0;
            }
            else
            {
                sum++;
                krr[i][j]=sum;
            }
        }
    }

    for(int i=1;i<=n;i++)
    {
      //  int sum=0;
        for(int j=m;j>=1;j--)
        {
            if(j+1<=m&&krr[i][j]!=0&&krr[i][j+1]!=0)
            {
                krr[i][j]=krr[i][j+1];
            }
        }
    }



   int counter=0;

   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=m;j++)
       {
           counter=max(counter,frr[i][j]+krr[i][j]);
       }
   }
cout<<counter-1<<endl;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100010
int n,X,Y,Z,a[N],b[N],c[N],id[N];
ll ans,tmp,s1[N],s2[N];
priority_queue<int,vector<int>,greater<int> >q;
inline char gc(){
    static char *S,*T,buf[1<<16];
    if(T==S){T=(S=buf)+fread(buf,1,1<<16,stdin);if(T==S) return EOF;}
    return *S++;
}
inline int read(){
    int x=0,f=1;char ch=gc();
    while(ch<'0' || ch>'9'){if(ch=='-') f=-1;ch=gc();}
    while('0'<=ch && ch<='9') x=x*10+ch-'0',ch=gc();
    return x*f;
}
inline bool cmp(int x,int y){return a[x]-b[x]>a[y]-b[y];}
int main(){
	X=read();Y=read();Z=read();n=X+Y+Z;
	for(int i=1;i<=n;++i){
		a[i]=read();b[i]=read();c[i]=read();
		id[i]=i;tmp+=b[i];
	}
	sort(id+1,id+n+1,cmp);
	for(int i=1;i<=X;++i){
		s1[i]=s1[i-1]+a[id[i]]-b[id[i]];
		q.push(a[id[i]]-c[id[i]]);
	}
	for(int i=X+1;i<=X+Z;++i){
		s1[i]=s1[i-1]+c[id[i]]-b[id[i]];
		if(a[id[i]]-c[id[i]]>q.top()){
			int x=q.top();q.pop();
			q.push(a[id[i]]-c[id[i]]);
			s1[i]+=-x+a[id[i]]-c[id[i]];
		}
	}
	while(!q.empty()) q.pop();
	for(int i=n;i>=n-Y+1;--i){
//		s2[i]=s2[i-1]+c[id[i]]-b[id[i]];
		q.push(b[id[i]]-c[id[i]]);
	}
	for(int i=n-Y;i>=X+1;--i){
		s2[i]=s2[i+1]+c[id[i]]-b[id[i]];
		if(b[id[i]]-c[id[i]]>q.top()){
			int x=q.top();q.pop();
			q.push(b[id[i]]-c[id[i]]);
			s2[i]+=-x+b[id[i]]-c[id[i]];
		}
	}
	for(int i=X;i<=X+Z;++i){
		ans=max(ans,tmp+s1[i]+s2[i+1]);
	}
	printf("%lld\n",ans);
	return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    lli n1 , n2 , s ;
    cin >> n1 >> n2 ;
    s = n1 + n2 ;
    if (s % 2 == 0) cout << s / 2 ;
    else cout << "IMPOSSIBLE" ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int N;
long int x;


int cmpnum(const void * n1,const void * n2)
{
    if(*(int *)n1 < *(int *)n2)
	return -1;
    else if(*(int *)n1 > *(int *)n2)
	return 1;
    else 
	return 0;
}

int main()
{
    int count=0,j=0;
    long int cannum[100];
    scanf("%d %ld",&N,&x);
    for(int i=0;i<N;i++)
	scanf("%ld",&cannum[i]);

    qsort(cannum,N,sizeof(long int),cmpnum);

    for(j=0;j<N;j++){
	if(cannum[j]<=x)
	    count++;
	else
	    break;
	x-=cannum[j];
    }

    if(x!=0 && count!=0 && j==N)
	count--;

    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 128
#include <iostream>

const int Max_x = 17;
const int Max_y = 17;
bool u_c[Max_x][Max_y]; //使うのは1-16

void format(){
	for(int i = 0; i < Max_x; ++i){
		for(int j = 0; j < Max_y; ++j){
			if(i == 0 || j == 0){
				u_c[i][j] = true;
			}
			else{
				u_c[i][j] = false;
			}
		}
	}
}

int calc_road(int x, int y){
	if(x == 1 && y == 1){
		return 1;
	}
	else if(x <= 0 || y <= 0){
		return 0;
	}
	else{
		int num;
		if(u_c[x - 1][y] && u_c[x][y - 1]){
			return 0;
		}
		else if(u_c[x - 1][y]){
			num = calc_road(x, y - 1);
			return num;
		}
		else if(u_c[x][y - 1]){
			num = calc_road(x - 1, y);
			return num;
		}
		else{
			num = calc_road(x - 1, y) + calc_road(x, y - 1);
			return num;
		}
	}

}

int main(){
	int a, b;
	while(std::cin >> a >> b){
		if(a == 0 && b == 0){
			break;
		}
		int n;
		std::cin >> n;
		format();
		for(int i = 0; i < n; ++i){
			int x, y;
			std::cin >> x >> y;
			u_c[x][y] = true;
		}
		
		std::cout << calc_road(a, b) << std::endl;
	}
}

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

def f(x):
    return x**5

def idx(i):
    if(i%2==0): return i//2
    else: return -(i//2)

five = []
for i in range(200):
    five.append(f(i))
    five.append(f(-i))


res = [0, 0]
flg = False
for i in range(400):
    for j in range(400):
        a = five[i]
        b = five[j]
        
        if(a - b == x):
            res = [idx(i), idx(j)]
            flg = True
            break
    if flg:
        break
        

print(res[0], res[1])

Measured memory_bytes: 9224
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001 
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl> 
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define set(x,k) memset(x,k,sizeof(x))
#define cy cout << "YES" << endl
#define  cn cout << "NO" << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll spf[MAXN]; 
void sieve() 
{ 
    spf[1] = 1; 
    for (auto i=2; i<MAXN; i++) 
  		spf[i] = i; 
  	for (auto i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
    for (auto i=3; i*i<MAXN; i++) 
    {
        if (spf[i] == i) 
        { 
            for (auto j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
	return;
} 

vl getFactorization(ll x) 
{ 
    vl ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 


void check()
{
	ll n,k;
	cin>>n>>k;
	vl a(n);
	for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    ll start = 1, end=INT_MAX;
	ll ans=a[0];
    while(start<=end) {
        ll m = start + (end-start)/2;
        ll flag=0;
        for(ll i=0;i<n;i++) flag+=(a[i]-1)/m;
        if(flag<=k) ans=m,end=m-1;
        else start=m+1;
    }   
    cout << ans << endl;
    return ;
}

int32_t main()
{
    fastio;
    ll t = 1;
    //cin >> t;
    while(t--)
        check();
    return 0;
}

Measured memory_bytes: 4748
using System;
using System.Collections.Generic;

namespace Project
{
	class MainClass
	{
		public static long count = 0;

		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
			MergeSort(a, 0, n);
			Console.WriteLine(count);
		}

		public static void Merge(int[] A, int left, int mid, int right)
		{
			int n1 = mid - left;
			int n2 = right - mid;
			int[] L = new int[n1 + 1];
			int[] R = new int[n2 + 1];
			for (int l = 0; l < n1; l++)
			{
				L[l] = A[left + l];
			}
			for (int l = 0; l < n2; l++)
			{
				R[l] = A[mid + l];
			}
			L[n1] = int.MaxValue;
			R[n2] = int.MaxValue;
			int i = 0;
			int j = 0;
			for (int k = left; k < right; k++)
			{
				if (L[i] <= R[j])
				{
					A[k] = L[i];
					i++;

				}
				else
				{
					A[k] = R[j];
					count += n1 - i;
					j++;
				}
			}
		}

		public static void MergeSort(int[] A, int left, int right)
		{
			if (left + 1 < right)
			{
				int mid = (left + right) / 2;
				MergeSort(A, left, mid);
				MergeSort(A, mid, right);
				Merge(A, left, mid, right);
			}
		}
	}
}

Measured memory_bytes: 36004
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    int n,m;cin>>n>>m;
    int l,r;
    int lmax=0, rmin=1e5;
    rep(i, m){
        cin>>l>>r;
        if(lmax<l)lmax = l;
        if(rmin>r)rmin = r;
    }
    co(max(0,rmin-lmax+1));
}


Measured memory_bytes: 256
//
//AtCoder Beginner Contest 178
//A
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int x;
    cin >> x;

    if (x==0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3604
from collections import defaultdict
n = int(input())
S = input()
patterns = ["RGB","RBG","GBR","GRB","BRG","BGR"]
acc  = [ [0] * (n + 1) for _ in range(n+1)]

ans = 0
for pattern in patterns:
    c1 = pattern[0]
    c2 = pattern[1]
    c3 = pattern[2]
    cands = []
    #i c1の位置で
    for i1 in range(n):
        for i2 in range(i1 + 1,n):
            if S[i1] == c2 and S[i2] == c3:
                cands.append((i1,i2-i1))
    # anss[i1][i2-i1]→左をi1に固定したときの、距離i2-i1の組の個数
    cands.reverse()
    di = defaultdict(lambda :set())
    for cand in cands:
        left,dist = cand
        di[left].add(dist)
    acc = [0]
    for i in range(1,n):
        acc.append(acc[i-1] + len(di[i]))

    for  i in range(0,n):
        if S[i] == c1:
            ans += acc[n - 1] -acc[i]
            for i2 in range(i + 1,n):
                if i2 - i in di[i2]:
                    ans -=1
print(ans)


Measured memory_bytes: 450976
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include <utility>
#include <cstdio>
#include<algorithm>
#include<queue>
#define ll  long long
#define md 1000000007

using namespace std;
	int n;
int main(){
    cin>>n;
    vector<ll> a(n), res(n,0);
    for(int i=0; i<n; i++)scanf("%lld", &a[i]);

    vector<ll> b(1), ind(1); ind[0] = 0; b[0] = a[0];
    int cur =0;
    for(int i=1; i<n; i++){
	if(a[i]>b[cur]){
	    ind.push_back(i); b.push_back(a[i]); cur++;
	}
    }

    sort(a.begin(), a.end());
	int c=0;
    for(int i=0; i<ind.size(); i++){
	ll sum = 0;
//	int start=0; if(i>0) start = b[i-1]+1;
	ll endd =  b[i]; ll diff = b[i]; if(i>0)diff-=b[i-1];
	for(;c<n && a[c]<=endd; c++){
	    sum+=a[c]; if(i>0)sum-=b[i-1];
	}
	if(c<n)sum+=diff*(n-c);

	res[ind[i]] = sum;
    }
    
    for(int i=0; i<n; i++)printf("%lld\n", res[i]);
}

Measured memory_bytes: 4460
#include <cstdio>
#include <algorithm>
#include <stack>
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define llong long long

int main() {
  stack<int> st;
  int in;
  while(scanf("%d",&in) != EOF) {
    if(in == 0) {
      printf("%d\n",st.top());
      st.pop();
    }
    else {
      st.push(in);
    }
  }
  return 0;
}

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

int main()
{
  int n,r;
  int p,c;
  
  while(cin >> n >> r,n||r){

    vector<int> card(n,0);
    for(int i=0;i < n;i++){
      card[i]=i+1;
    }
    reverse(card.begin(),card.end());
    
    for(int i=0;i < r;i++){
      cin >> p >> c;
      rotate(card.begin(),card.begin()+p-1,card.begin()+p-1+c);
      
      // rotate(a,b,c):= [a,b)と[b,c)を入れ替え
    }
    cout << *card.begin() << endl;
  }
  return 0;
}



Measured memory_bytes: 3156
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int data[] = new int[n];
    boolean t = true;

    for (int i = 0 ; i < n ; i++ ) {
      data[i] = sc.nextInt();
    }

    for (int i = 0 ; i < n ; i++) {
      if ((data[i] % 2 == 0 && (data[i] % 3 == 0 || data[i] % 5 == 0)) || data[i] % 2 == 1) {
        t = true;
        continue;
      } else {
        t = false;
        break;
      }
    }

      if (t == true) {
        System.out.println("APPROVED");
      } else {
      System.out.println("DENIED");
      }

  }
}


Measured memory_bytes: 23764
using System;

namespace debug
{
    class Program
    {
        static void Main(string[] args)
        {
            ProgramB a = new ProgramB();
            a.main();

        }
    }

    //ABC115
    class ProgramA
    {
        public void main()
        {
            int D = int.Parse(Console.ReadLine());

            if (D == 25)
                Console.WriteLine("Christmas");
            else if (D == 24)
                Console.WriteLine("Christmas Eve");
            else if (D == 23)
                Console.WriteLine("Christmas Eve Eve");
            else
                Console.WriteLine("Christmas Eve Eve Eve");
        }
    }

    //ABC162
    class ProgramB
    {
        public void main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];

            for (int i = 0; i < n; i++)
                a[i] = int.Parse(Console.ReadLine());

            Array.Sort(a);
            int ans = 0;
            
            for (int i = 0; i < n; i++)
            {
                //偶数の時
                if (i == n - 1)
                {
                    ans += a[i] / 2;
                }
                else
                    ans += a[i];

            }

            Console.WriteLine(ans);
        }
    }

    //ABC161_F問題
    class ProgramF2
    { 
        public void main()
        {
            long n = long.Parse(Console.ReadLine());
            long count = 2;//nとn-1はすでにカウントしておく（答えなので）

            if(n == 2)
            {
                Console.WriteLine("1");
                return;
            }

            //n-1の約数はすべて満たす（よって、その数と逆数でカウント。平方数に注意）
            for(long i = 2; i <= Math.Sqrt(n - 1);i++)
            {
                if ((n - 1) % i == 0)
                {
                    if (i * i == n - 1)
                        count++;
                    else
                        count += 2;
                }

            }
            //nの約数にうち小さいほうのみを考える。iで割ってみて割り切れなくなった時にあまりが1かどうかで判定
            for (long i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    long t = n;
                    while(t % i == 0)
                    {
                        t /= i;
                    }

                    if(t % i == 1)
                        count++;
                }

            }

            Console.WriteLine(count);
        }
    }

}


Measured memory_bytes: 11092
nums = gets.to_i
possibility = [0, 1].repeated_permutation(nums).to_a
testenomies = []

nums.times do |i|
  testenomy_count = gets.to_i
  testenomy = []
  testenomy_count.times do
    data = gets.split.map(&:to_i)
    one_testenomy = { "object": (data[0] - 1), "content": data[1] }
    testenomy << one_testenomy
  end
  testenomies << testenomy
end

result = 0
possibility.each do |assertion|
  flag = true
  assertion.each_with_index do |ass, i|
    if ass == 1
      testenomies[i].each do |honesty_testenomy|
        if assertion[honesty_testenomy[:object]] != honesty_testenomy[:content]
          flag = false
          break
        end
      end
    end
    break unless flag
  end
  if flag == true
    result = assertion.count(1) if result < assertion.count(1)
  end
end

puts result

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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


#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
	os << "(" << pair_var.first << ", " << pair_var.second << ")";
	return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	os << "{";
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
	}
	os << "}";
	return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
	os << "{";
	repi(itr, map_var) {
		os << *itr;
		itr++;
		if (itr != map_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
	os << "{";
	repi(itr, set_var) {
		os << *itr;
		itr++;
		if (itr != set_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}

#define DUMPOUT cerr

void dump_func() {
	DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
	DUMPOUT << head;
	if (sizeof...(Tail) > 0) {
		DUMPOUT << ", ";
	}
	dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

	int N;
	cin >> N;

	if (N % 2 == 0) {
		cout << N / 2 - 1 << endl;
	}
	else {
		cout << N / 2 << endl;
	}

	return 0;
}


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

int main(){

    int N;
    cin >> N;

    vector <int> value(N);
    vector <int> cost(N);

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

    int x_y = 0;    
    for(int i = 0; i < N; i++){
        if(value[i] - cost[i] >= 0){
            x_y += value[i] - cost[i];
        }
    }

    cout << x_y << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
			using namespace std;
			#define rep(i,a,n) for (int i=a;i<n;i++)
			#define per(i,a,n) for (int i=n-1;i>=a;i--)
			#define pb push_back
			#define mp make_pair
			#define all(x) (x).begin(),(x).end()
			#define fi first
			#define se second
			#define SZ(x) ((int)(x).size())
			typedef vector<int> VI;
			typedef long long ll;
			typedef pair<int,int> PII;
			typedef double db;
			mt19937 mrand(random_device{}()); 
			const ll mod=1000000007;
			int rnd(int x) { return mrand() % x;}
			ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
			ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
			int main() {
				 ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
					int a,b,c;
					cin>>a>>b>>c;
					cout<<c<<" "<<a<<" "<<b;
			}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,a,i;
  a=0;
  string S;
  cin>>N>>S;
  for(i=0;i<N;i++){
  if(S[i]=='R') a++;
  }
  if(2*a>N){
  cout<<"Yes"<<endl;
  }else{
  cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int INF=1001001001;

int64_t func(int64_t x){
  if(x==1){return 1;}
  int64_t a=func(x/2);
  return a*2+1;
}
int main() {
  int64_t H;
  cin>>H;
  cout<<func(H)<<endl;

  return 0;}

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

public class Main {
	static HashMap<String, Integer> map = new HashMap<String, Integer>();
	static int n,m;
	static int[] v,t;
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String s = br.readLine();
		int l = s.length();
		char c1 = '1';
		char c2 = '2';
		for(int i = 0; i < l; i++){
			char c = s.charAt(i);
			if(c==c1){
				sb.append(i).append(' ').append(i+1);
				System.out.println(sb);
				return;
			}else if(c==c2){
				sb.append(i-1).append(' ').append(i+1);
				System.out.println(sb);
				return;
			}
			c2 = c1;
			c1 = c;
		}
		sb.append("-1 -1");
		System.out.println(sb);
	}
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
    int a; cin >> a;
    cout << (48 - a) << endl;
}


Measured memory_bytes: 256