akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define repm(i, m, n) for (int i = (m); i < (n); i++)
#define rep_rev(i, n) for (int i = int (n); i >= 0; i--)
typedef long long ll;
using namespace std;

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

	bool isR = true;
	int r = 1, l = 1, r_address=0, l_address=0, n[100000] = {};
	char now = 'R';
	rep1(i, s.size()) {
		if (s[i - 1] == 'R') {
			if (s[i] == 'R') {
				r++;
				n[i] = 0;
			}
			else if (s[i] == 'L') {
				r_address = i - 1;
				l_address = i;
			}
		}
		else if (s[i - 1] == 'L') {
			if (s[i] == 'R') {
				int sum = r + l;
				n[r_address] = n[l_address] = sum / 2;
				if (sum % 2 == 1) {
					if (r % 2 == 1) {
						n[r_address]++;
					}
					else if (l % 2 == 1) {
						n[l_address]++;
					}
				}
				r = l = 1;
			}
			else if (s[i] == 'L') {
				l++;
				n[i] = 0;
			}
		}
		if (i == s.size() - 1) {
			int sum = r + l;
			n[r_address] = n[l_address] = sum / 2;
			if (sum % 2 == 1) {
				if (r % 2 == 1) {
					n[r_address]++;
				}
				else if (l % 2 == 1) {
					n[l_address]++;
				}
			}
		}
	}
	rep(i, s.size())cout << n[i] << " "; cout << endl;

	return 0;
}

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

long long int n,m;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        long long int a;
        cin>>a;
        n-=a;
    }
    cout<<max(n,-1LL);
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define ulli unsigned long long int
#define ld long double  
#define endl "\n"
using namespace std; 

void solve() {
    int n;
    cin >> n;
    vector<int> v(n);

    for (int& x: v) {
        cin >> x;
    }

    sort(v.begin(), v.end());
    int ans = v[n/2] - v[n/2 - 1];
    cout << ans << endl;
}

int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
  
    int t = 1; 
    //cin >> t; 
    while (t--) { 
        solve(); 
    } 
  
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
    return 0; 
} 


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

const int NIL = -1;
const int MAX = 2147483647;
clock_t START, END;

struct Node {
	int l, r, key, lazy;
};

bool debug = false;
Node Tree[500010];
int mark[500010], lazy[500010];
int n = 0, N = 1;


void update(int x, int y, int z, int k, int height)
{
	if (!mark[k]) {
		Tree[k].l = k * (1 << height) - N;
		Tree[k].r = min(Tree[k].l + (1 << height) - 1, n - 1);
		mark[k] = 1;
	}
	if (x > y)
		return;
	if (x <= Tree[k].l && Tree[k].r <= y) {
		Tree[k].lazy += z;
		return;
	}
	else if (Tree[k].r < x || Tree[k].l > y) {
		return;
	}
	else {
		if (Tree[k].lazy) {
			Tree[2 * k].lazy += Tree[k].lazy;
			Tree[2 * k + 1].lazy += Tree[k].lazy;
			Tree[k].key += (Tree[k].r - Tree[k].l + 1) * Tree[k].lazy;
			Tree[k].lazy = 0;
		}
		update(x, min(Tree[k].l + (1 << (height - 1)) - 1, y), z, 2 * k, height - 1);
		update(max(Tree[k].l + (1 << (height - 1)), x), y, z, 2 * k + 1, height - 1);
	}
}

int find(int k, int height, int z)
{
	/*if (!mark[k]) {
		Tree[k].l = k * (1 << height) - N;
		Tree[k].r = min(Tree[k].l + (1 << height) - 1, n - 1);
		mark[k] = 1;
	}
	if (Tree[k].lazy) {
		Tree[2 * k].lazy += Tree[k].lazy;
		Tree[2 * k].key += Tree[k].lazy;
		Tree[2 * k + 1].lazy = Tree[k].lazy;
		Tree[2 * k + 1].key += Tree[k].lazy;
		return Tree[k].key;
	}
	else {
		if (z <= Tree[k].l + (1 << (height - 1)) - 1)
			return find(2 * k, height - 1, z);
		else
			return find(2 * k + 1, height - 1, z);
	}*/
	int sum = Tree[N + z].key;
	int x = N + z;
	while (x > 0) {
		sum += Tree[x].lazy;
		x /= 2;
	}
	return sum;
}

int main(void)
{
	if (debug) {
		START = clock();
		freopen("in15.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int q, com, x, s, t, k, height = 0;
	scanf("%d%d", &n, &q);
	while (N < n) {
		N *= 2;
		height++;
	}
	/*for (int i = 1; i <= n + N - 1; i++) {
		Tree[i].key = 0;
		Tree[i].lazy = 0;
	}*/
	for (int i = 0; i < q; i++) {
		scanf("%d", &com);
		if (com) {
			scanf("%d", &k);
			printf("%d\n", find(1, height, k - 1));
		}
		else {
			scanf("%d%d%d", &s, &t, &x);
			update(s - 1, t - 1, x, 1, height);
		}
	}
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 7172
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

// 最小公約数
long lcm(long a, long b) {
	return a / gcd(a, b) * b;
}*/

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

	int a, b;
	cin >> a >> b;

	int ans;

	ans = a * b - a - b + 1;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
vector<int> g[200020];
int n;
int c[200020], sz[200020];
ll s[200020];
void merge(map<int, int> &a, map<int, int> &b){
	if(a.size()<b.size()) swap(a, b);
	for(auto p:b){
		a[p.first]+=p.second;
	}
}
void dfs(int x, int p, map<int, int> &mp){
	sz[x]=1;
	for(auto y:g[x]){
		if(y==p) continue;
		map<int, int> mpy;
		dfs(y, x, mpy);
		sz[x]+=sz[y];
		ll c1=sz[y];
		if(mpy.find(c[x])!=mpy.end()){
			c1-=mpy[c[x]];
		}
		s[c[x]]+=c1*(c1+1)/2;
		merge(mp, mpy);
	}
	mp[c[x]]=sz[x];
}
int main()
{
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>c[i]; c[i]--;
	}
	for(int i=0; i<n-1; i++){
		int a, b; cin>>a>>b; a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	map<int, int> mp;
	dfs(0, -1, mp);
	for(int i=0; i<n; i++){
		if(i==c[0]) continue;
		ll c1=n-mp[i];
		s[i]+=c1*(c1+1)/2;
	}
	for(int i=0; i<n; i++) cout<<(ll)n*(n+1)/2-s[i]<<endl;
	return 0;
}


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

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

    int L[N];                       //配列注意
    for (int i = 0; i < N; i++){
        cin >> L[i];
    }
    
    sort(L, L + N, greater<int>()); // L[0:N] を大きい順にソート

    for (int i = 0; i < K; i++){
        ans += L[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
long long min(long long n,long long m){
    if(n<m) return n;
    else return m;
}
int main(void){
    long long a,b,c,k;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
    if(k<=a) printf("%lld",k);
    else if(k<=a+b) printf("%lld",a);
    else printf("%lld",a+min((k-a-b),c)*-1);
}

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

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=4000+19;
const int p=1e9+7;

int f[N][2*N],g[N][2*N];
int n,m,k,num,ans;

void upd(int &x,int y){
	x=(x+y)%p;
}

int main(){
	n=IN(),m=IN(),k=IN();
	f[0][0]=1;
	f[0][1]=p-1;
	For(i,0,N-1){
		For(j,0,N){
			if (j){
				upd(f[i][j],f[i][j-1]);
				upd(g[i][j],g[i][j-1]);
			}
			upd(f[i+1][j],f[i][j]);
			upd(f[i+1][j+k],p-f[i][j]);
			upd(g[i][j+1],f[i][j]);
			upd(g[i][j+k],p-f[i][j]);
		}
	}
	num=(n+m-1)/(k-1)-1;
	For(i,0,num+1) For(j,0,num+1)
		if (i*(k-1)<=n&&i+j<=num){
			upd(ans,g[num-i-j][n-i*(k-1)]);
		}
	printf("%d\n",ans);
}

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

int main(){
  int n,k,h,sum;
  int i=0;
  cin>>n;
  cin>>k;
  for(i=0;i<n;i++){
    cin>>h;
    if(k<=h)
      sum++;
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
mod = 10**9+7
fact = {}
for j in range(2, N+1):
    for i in range(2, j+1):
        while j % i == 0:
            if i in fact.keys():
                fact[i] += 1
            else:
                fact[i] = 2
            j //= i
ans = 1
for v in fact.values():
    ans *= v
    ans %= mod
print(ans)


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

struct StCoord
{
  StCoord() : m_nx(0), m_ny(0), m_nHigh(0) { }

  int m_nx;
  int m_ny;
  int m_nHigh;
};

void fnInput(vector<StCoord>& rvoCoord)
{
  int nCoordSiz;
  cin >> nCoordSiz;
  rvoCoord.resize(nCoordSiz);

  for (StCoord& roCoord : rvoCoord)
    cin >> roCoord.m_nx >> roCoord.m_ny >> roCoord.m_nHigh;
}

int fnCenterHigh(StCoord oCenter, StCoord oCoord)
{
  return  abs(oCenter.m_nx - oCoord.m_nx) 
        + abs(oCenter.m_ny - oCoord.m_ny) + oCoord.m_nHigh;
}

bool fnCenterCheck(StCoord& roCenter, const vector<StCoord>& cnrvoCoord)
{
  int nCenterHigh = 0;

  for (int i = 0; i < cnrvoCoord.size(); ++i)
    if ( cnrvoCoord[i].m_nHigh )
      if ( !nCenterHigh )
        nCenterHigh = fnCenterHigh(roCenter, cnrvoCoord[i]);
      else
        if (nCenterHigh != fnCenterHigh(roCenter, cnrvoCoord[i]))
          return false;

  for (int i = 0; i < cnrvoCoord.size(); ++i)
    if ( !cnrvoCoord[i].m_nHigh )
      if (nCenterHigh <= fnCenterHigh(roCenter, cnrvoCoord[i]));
      else
        return false;

  roCenter.m_nHigh = nCenterHigh;
  return true;
}

void fnCenterCoord(const vector<StCoord>& cnrvoCoord)
{
  StCoord oCenter;
  bool bCenter = false;
  oCenter.m_nx = -1;

  while ( !bCenter       &&
          oCenter.m_nx < 100 )
  {
    ++oCenter.m_nx;
    oCenter.m_ny = -1;

    while ( !bCenter       &&
            oCenter.m_ny < 100 )
    {
      ++oCenter.m_ny;
      bCenter = fnCenterCheck(oCenter, cnrvoCoord);
    }
  }
  if ( bCenter )  
    cout << oCenter.m_nx << " " << oCenter.m_ny << " " << oCenter.m_nHigh;
}
  
int main()
{
  vector<StCoord> voCoord;
  
  fnInput(voCoord);
  fnCenterCoord(voCoord);

  return 0;
}

Measured memory_bytes: 3560
n = int(input())
s = list(input())

R_count = [0]*n
G_count = [0]*n
B_count = [0]*n

Rc = 0
Gc = 0
Bc = 0

for i in range(1,n+1):
    if s[-i] == "R":
        Rc += 1
    elif s[-i] == "G":
        Gc += 1
    else:
        Bc += 1
        
    R_count[-i] = Rc
    G_count[-i] = Gc
    B_count[-i] = Bc

ans = 0

for i in range(n):
    if s[i] == "R":
        for j in range(i+1,n-1):
            if  s[j] == "G":
                ans += B_count[j+1]
                if j+j-i+1 > n:
                    continue
                if s[j+j-i] == "B":
                    ans -= 1
            if s[j] == "B":
                ans += G_count[j+1]
                if j+j-i+1 > n:
                    continue
                if s[j+j-i] == "G":
                    ans -= 1               

    if s[i] == "B":
        for j in range(i+1,n-1):
            if  s[j] == "R":
                ans += G_count[j+1]
                if j+j-i+1 > n:
                    continue
                if s[j+j-i] == "G":
                    ans -= 1
            if s[j] == "G":
                ans += R_count[j+1]
                if j+j-i+1 > n:
                    continue
                if s[j+j-i] == "R":
                    ans -= 1

    if s[i] == "G":
        for j in range(i+1,n-1):
            if  s[j] == "R":
                ans += B_count[j+1]
                if j+j-i+1 > n:
                    continue
                if s[j+j-i] == "B":
                    ans -= 1
            if s[j] == "B":
                ans += R_count[j+1]
                if j+j-i+1 > n:
                    continue
                if s[j+j-i] == "R":
                    ans -= 1
    
print(ans)

Measured memory_bytes: 69256
#include<iostream>
#include<string>
int main(){
    std::string num[2];
    std::cin>>num[0]>>num[1];
    if(std::stoi(num[0],nullptr,16)==std::stoi(num[1],nullptr,16))printf("=");
    else if(std::stoi(num[0],nullptr,16)<std::stoi(num[1],nullptr,16))printf("<");
    else if(std::stoi(num[0],nullptr,16)>std::stoi(num[1],nullptr,16))printf(">");
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby
# frozen_string_literal: true
n = gets.to_i
pi = gets.split.map(&:to_i)
check = 0
(1...n-1).each do |i|
  l = pi[i-1]
  r = pi[i+1]
  check += 1 if [l,r,pi[i]].sort[1] == pi[i]
end
puts check


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

ll N, K;
ll res;
int main(void){
    cin >> N >> K;
    while(N+1 - K >= 0){
        res += ((2*N-K+1)*K/2 - K*(K-1)/2 + 1) % 1000000007;
        res %= 1000000007;
        K++;
    }
    cout << res << endl;
    return 0;
}



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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    i64 N,M,Q;
    cin >> N >> M >> Q;

    vector<i64> L(M),R(M);
    static i64 cnt[512][512];
    fill_n((i64*)cnt,512*512,0);
    rep(i,0,M){
        cin >> L[i] >> R[i];
        --L[i];
        --R[i];
        ++cnt[L[i]][R[i]];
    }

    rep(i,0,512) rep(j,1,512) cnt[i][j]+=cnt[i][j-1];

    rep(i,0,Q){
        i64 p,q;
        cin >> p >> q;
        --p;
        --q;

        i64 ans=0;
        rep(j,p,q+1) ans+=cnt[j][q];
        cout << ans << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 6144
#include<bits/stdc++.h>
#define ull unsigned long long
# define ll long long
# define mod 1000000007LL 
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll arr[5];
    for(int i=0;i<5;i++)
    {
        cin>>arr[i];
        if(arr[i]==0)
        {
        cout<<i+1;
        break;
        }
    }


    
    return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*
import kotlin.math.*

fun main() {
    var fs = Atcoder.FastReader()
    var n =fs.nextInt()
    if(n>=30) println("Yes")
    else println("No")
}

class Atcoder {
    internal class FastReader {
        private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))
        private var st: StringTokenizer? = null

        operator fun next(): String {
            while (st == null || !st!!.hasMoreElements()) {
                try {
                    st = StringTokenizer(br.readLine())
                } catch (e: IOException) {
                    e.printStackTrace()
                }

            }
            return st!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return java.lang.Long.parseLong(next())
        }

        fun nextDouble(): Double {
            return java.lang.Double.parseDouble(next())
        }

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

        fun readIntArray(n: Int): IntArray {
            val a = IntArray(n)
            for (i in 0 until n) a[i] = nextInt()
            return a
        }

        fun readLongArray(n: Int): LongArray {
            val a = LongArray(n)
            for (i in 0 until n) a[i] = nextLong()
            return a
        }

        fun readDoubleArray(n: Int): DoubleArray {
            val a = DoubleArray(n)
            for (i in 0 until n) a[i] = nextDouble()
            return a
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

#define getBit(x,i) (x&(1<<i))
#define setBit(x,i) (x|(1<<i))
#define mem(A,N) memset(A,N,sizeof(A))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define rep(i, x, y)  for(int i = x; i < y; ++i)
#define Rep(i, x, y)  for(int i = x; i <= y; ++i)
#define srep(i, x, y) for(int i = x; i > y; --i)
#define sRep(i, x, y) for(int i = x; i >= y; --i)
#define all(v) v.begin(),v.end()
#define Sort(x) sort(x.begin(), x.end())
#define f1(i,n) for (int i=1; i<=n; i++)
#define f0(i,n) for (int i=0; i<n; i++)
#define sz(x) ((int)(x).size())
#define len(x) ((int)(x).length())
#define fi first
#define se second

#define linf 0x7FFFFFFFFFFFFFFF
#define inf 0x7FFFFFFF
#define mod 1000000007
#define eps 1e-9
#define Pi 3.14159265358979323846

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define write(x) cerr << #x << " = " << (x) << ", ";
#define writeI0 cerr << "i = " << 0 << ", ";
#define dumpI0 cerr << "i = " << 0 << endl;
#define printSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printPairSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define printVector(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printArray(a,x,y) for(auto it = a+x; it != a+y; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;
#define PrintArray(a,x,y) for(auto it = a+x; it != a+y+1; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;

// ***************** End Of Template ********************

ll n;
ll a, b;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n >> a >> b;
    ll sol1 = b-a;
    ll sol2 = b-1;
    ll sol3 = (n-a);

    ll t = a-1;
    if ((b-t-1) % 2 == 0) {
        sol2 = min(sol2, t + (b-t-1)/2);
    }
    else {
        sol2 = min(sol2, t + 1 + (b-1 - t-1)/2);
    }

    t = n-b;
    if ((n-(a+t)) % 2 == 0) {
        sol3 = min(sol3, t + (n-(a+t))/2);
    }
    else {
        sol3 = min(sol3, t + 1 + (n-(a+t+1))/2);
    }

    if (sol1 % 2 == 0)
        cout << min(min(sol1/2LL,sol2), sol3) << '\n';
    else
        cout << min(sol2, sol3) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h> 
#include <algorithm> 
using namespace std; 
int A[210000]; 
int main(){ 
  int N;scanf("%d",&N); 
  for(int i=0;i<N;i++)scanf("%d",A+i); 
  std::sort(A,A+N); 
  for(int i=0;i<N-1;i++){ 
    if(A[i]==A[i+1]){ 
      printf("NO\n");return 0; 
    } 
  } 
  printf("YES\n"); 
}

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

using namespace std;
using ll = long long;

vector<pair<char, int>> bubble_sort(int n, vector<pair<char, int>> a) {
    for(int i = 0; i < n; ++i) {
        for(int j = n - 1; j > i; j--) {
            if(a[j].second < a[j - 1].second) swap(a[j], a[j - 1]);
        }
    }

    return a;
}

vector<pair<char, int>> selection_sort(int n, vector<pair<char, int>> a) {
    for(int i = 0; i < n; ++i) {
        auto itr_min = min_element(a.begin() + i, a.end(), 
                [](pair<char, int> p1, pair<char, int> p2) {
                    return p1.second < p2.second;
                }
            );
        swap(a[i], *itr_min);
    }

    return a;
}

void print(vector<pair<char, int>> a) {
    for(int i = 0; i < a.size(); ++i) {
        printf("%c%d", a[i].first, a[i].second);
        printf(i == (int)a.size() - 1 ? "\n" : " ");
    }
}

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

    int n;
    cin >> n;
    string s;
    vector<pair<char, int>> a(n), a_bubble(n), a_selection(n);
    for(int i = 0; i < n; ++i) {
        cin >> s;
        a[i].first = s[0];
        a[i].second = s[1] - '0';
    }

    a_bubble = bubble_sort(n, a);
    a_selection = selection_sort(n, a);

    print(a_bubble);
    printf("Stable\n");
    print(a_selection);
    printf(a_bubble == a_selection ? "Stable\n" : "Not stable\n");

    return 0;
}


Measured memory_bytes: 3352
#include<cstdio>
#include<cstring>
char a[10001];
int main(){
    gets(a);
    bool ans=false;
    int l=strlen(a);
    for(int i=0;i<l;i++){
        if(a[i]=='C') {
            for(int j=i;j<l;j++){
                if(a[j]=='F') ans=true;
            }
        }
    }
    if(ans){
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}


Measured memory_bytes: 128
using System;

public class Test
{
	public static void Main()
	{
			string[] data = Console.ReadLine().Split();//????????\?????????
            int a = 0, b = 0, c = 0; //??????????????´??°
            int num = 0;//?´???°?????°
            a = int.Parse(data[0]);//??????????????°?????????
            b = int.Parse(data[1]);//??????????????°?????????
            c = int.Parse(data[2]);//??????????????°?????????

            for (int x = a; x <= b; x++)
            {
                if (c % x == 0)
                {
                    num++;
                }
            }


             Console.WriteLine(num);
	}
}

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a%c){
		puts("Yes");
		for(int i=0;i<a;i++){
			for(int j=0;j<b;j++){
				if(j) cout<<" ";
				if(i%c==c-1) cout<<-1000*(c-1)-1;
				else cout<<1000;
			}
			cout<<endl;
		}
	}
	else if(b%d){
		puts("Yes");
		for(int i=0;i<a;i++){
			for(int j=0;j<b;j++){
				if(j) cout<<" ";
				if(j%d==d-1) cout<<-1000*(d-1)-1;
				else cout<<1000;
			}
			cout<<endl;
		}
	}
	else puts("No");
	return 0;
}


Measured memory_bytes: 1536
h, w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
grid = [[' ']*w for i in range(h)]

ci = 0
for i in range(h):
    for j in range(w):
        if not a[ci]: ci+= 1
        if i%2==0: grid[i][j] = ci+1
        else: grid[i][~j] = ci+1
        a[ci]-= 1
for row in grid: print(*row)

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

int main()
{
  int N;
  cin >> N;
  string S;
  cin >> S;
  int max = 0, x = 0;
  for (int i = 0; i < N; ++i)
  {
    x += (('I' == S[i]) ? 1 : -1);
    if (max < x)
      max = x;
  }
  cout << max;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
H,W = map(int,input().split())
A = []
for i in range(H):
    A.append([0 if i == "#" else H+W for i in list(input())])
A = np.array(A)
for i in range(H-1):
    A[i+1,:] = np.minimum(A[i,:]+1,A[i+1,:])
for i in range(H-1,0,-1):
    A[i-1,:] = np.minimum(A[i,:]+1,A[i-1,:])
for i in range(W-1):
    A[:,i+1] = np.minimum(A[:,i]+1,A[:,i+1])
for i in range(W-1,0,-1):
    A[:,i-1] = np.minimum(A[:,i]+1,A[:,i-1])
print(np.max(A))

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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    vector<long long> B(N);
    vector<pair<long long, long long>> dis;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            long long disA, disB;
            if ((A[i] >= A[j] && B[i] >= B[j]) || (A[i] <= A[j] && B[i] <= B[j])) {
                disA = max(A[i], A[j]) - min(A[i], A[j]);
                disB = max(B[i], B[j]) - min(B[i], B[j]);
            } else {
                if (A[i] > A[j]) {
                    disA = A[j] - A[i];
                    disB = B[j] - B[i];
                } else {
                    disA = A[i] - A[j];
                    disB = B[i] - B[j];
                }
            }
            dis.push_back(make_pair(disA, disB));
        }
    }
    
    sort(dis.begin(), dis.end());
    dis.push_back(make_pair(0, 0));
    
    pair<long long, long long> now = dis[0];
    long long cnt = 1;
    long long mx = 0;
    for (int i = 1; i < dis.size(); i++) {
        if (now == dis[i]) {
            cnt++;
        } else {
            now = dis[i];
            mx = max(mx, cnt);
            cnt = 1;
        }
    }
    
    long long ans = N;
    ans -= mx;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,men,fish,num,fishmax;
    cin>>n;
    for(int i=0;i<n;i++){
    cin>>men>>fish;
    if(i==0){
        num=men;
        fishmax=fish;
    }
    else {
        if(fish>fishmax){
            fishmax=fish;
            num=men;
        }
        else if(num>men&&fish==fishmax)num=men;
    }
   }
   cout<<num<<" "<<fishmax<<endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define all(a) a.begin(),a.end()
#define dbg_v(v) cout<<#v<<":";for(auto x:v) cout<<" "<<x; cout<<endl;
ll power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;	
	int ans=0;
	for(int i=1;i<n;i++){
		int t=0;
		for(int j=1;j*j<=n-i;j++){
			if((n-i)%j==0){
				t++;
				if((n-i)/j!=j)
					t++;
			}
		}
		ans+=t;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3660
N = int(input())
def f(c):
    if len(str(c)) == 1:
        return c
    p = 10 ** len(str(c)) - 1
    for i in range(len(str(c))):
        if c - (10 ** i) > 0:
            q = sum(map(int, list(str(c - (10 ** i))))) + 1
            if q < p:
                p = q
    return p
print(f(N))

Measured memory_bytes: 3060
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

int N, A, B;
int sum = 0;

int main()
{
	scanf("%d %d %d", &N, &A, &B);

	for(int i = 1; i <= N; i++)
	{	
		int temp = 0;
		int test = i;
		while(test)
		{
			temp += test % 10;
			test = test / 10;
		}
		if(temp >= A && temp <= B)
		{
			sum += i;
			// cout << " temp ->" << temp << " sum ->" << sum << " i ->" << i;
		}
	}
	
	printf("%d", sum);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i] >> h[i];
  }

  vector<vector<int>> p(101, vector<int>(101, -1));
  bool ok = true;
  int again = -1;
  for (int info = 0; info < n; ++info) {
    if (ok) {
      if (h[info] == 0) {
        continue;
      } else {
        again = info;
        ok = false;
      }
    }

    for (int i = 0; i < 101; ++i) {
      for (int j = 0; j < 101; ++j) {
        if (p[i][j] == -2) {
          continue;
        } else if (p[i][j] != -1) {
          if (h[info] == 0) {
            if (p[i][j] > abs(x[info]-i) + abs(y[info]-j)) p[i][j] = -2;
          } else if (p[i][j] != h[info] + abs(x[info]-i) + abs(y[info]-j)) {
            p[i][j] = -2;
          }
        } else if (h[info] != 0) {
          p[i][j] = h[info] + abs(x[info]-i) + abs(y[info]-j);
        }
      }
    }
  }

  for (int info = 0; info < again; ++info) {
    for (int i = 0; i < 101; ++i) {
      for (int j = 0; j < 101; ++j) {
        if (p[i][j] == -2) {
          continue;
        } else if (p[i][j] > abs(x[info]-i) + abs(y[info]-j)) {
          p[i][j] = -2;
        }
      }
    }
  }

  for (int i = 0; i < 101; ++i) {
    for (int j = 0; j < 101; ++j) {
      if (p[i][j] != -2) {
        cout << i << " " << j << " " << p[i][j] << "\n";
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
#-*- coding:utf-8 -*-

while 1:
    n = int(raw_input())
    if not n:
        break
    columns = []
    for i in range(n):
        columns.append([])
    rows = []
    for i in range(n):
        row = [int(r) for r in raw_input().split(" ")]
        rows.append(min(row))
        for i in range(n):
            columns[i].append(row[i])

    result = 0
    for c in columns:
        if max(c) in rows:
            result = max(c)
            break

    print result

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

int main()
{
	int count[101] = {};
	int n;
	int Max = 0;

	while (cin >> n)
	{
		count[n]++;
	}
	for (int i = 1; i <= 100; i++)
	{
		Max = max(Max, count[i]);
	}
	for (int i = 1; i <= 100; i++)
	{
		if (count[i] == Max) cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    string S;
    cin >> S;

    if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3]) {
        cout << "No\n";
        return 0;
    }

    if (S[0] == S[1] && S[2] == S[3] || S[0] == S[2] && S[1] == S[3] || S[0] == S[3] && S[1] == S[2]) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    int n, x;
    std::cin >> n >> x;

    std::vector<int> m(n);
    for (int i = 0; i < n; i++) {
        std::cin >> m[i];
        x -= m[i];
    }

    int count = n;

    std::sort(m.begin(), m.end());
    while (x >= m[0]) {
        x -= m[0];
        count++;
    }

    std::cout << count << std::endl;
}


Measured memory_bytes: 256
t = $stdin.gets.chop!
t = t.split

for e in 0...t.length
    t[e] = t[e].to_i
end

array = []

if t[1] - t[0] + 1 < -1000000 then
    for e in -1000000...-1000000 + t[0]
        array.push(e)
    end
elsif  t[1] + t[0] > 1000000
    for e in 1000000 - t[0] + 1..1000000
        array.push(e)
    end
else
    for e in t[1] - t[0] + 1..t[1] + t[0] - 1
        array.push(e)
    end
end

print array.join(" ")


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll,ll>;
using pi = pair<int,int>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

bool check(ll a, ll b){
    rep(i,0,21){
        if((a>>i&1) && (b>>i&1))return false;
    }
    return true;
}

signed main(){
	//cout << fixed << setprecision(10);
    unordered_set<string> st;
    int n; cin >> n;
    rep(i,0,n){
        string s; cin >> s;
        st.emplace(s);
    }
    cout << st.size() << endl;
    
    
	return 0;
}

Measured memory_bytes: 17720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD=1e9+7;
ll inv(ll a, ll b = MOD){
    ll x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b != 0) {
        const ll q = a / b;
        ll tmp = a % b;
        a = b;
        b = tmp;
        tmp = x0 - q * x1;
        x0 = x1;
        x1 = tmp;
        tmp = y0 - q * y1;
        y0 = y1;
        y1 = tmp;
    }
    return (x0 + MOD) % MOD;
}
ll fact(ll x){
    // 再帰だとスタックオーバーフローするので
    ll ret = 1;
    for(ll a=2; a<=x; ++a){
        ret = (ret * a) % MOD;
    }
    return ret;
}
/*
【解法】
A = [1, 2, ..., n] と固定する（求める場合の数は、固定した場合の数の mPn 倍）。B を長さ n の数列とする

ある集合 S \subset {1, ..., n} の上で値が一致する（そのほかにも一致する値のある可能性がある）ような B の場合の数は g(S) = (m-|S|)P(n-|S|) 通り
（まだ決まっていない n-|S| 箇所の値を、使っていない m-|S| 個の値から重複しないように決める）

ある集合 S \subset {1, ..., n} の上でちょうど値が一致する（ S に属さない点 i ではA[i] != B[i] となる）ような
B の場合の数を f(S) 通りとすると、g(S) = \sum_{S\subset T} f(T) となる。

F(S) = f({1, ..., n} \setminus S), G(S) = g({1, ..., n} \setminus S) とおくと、
G(S) = \sum_{T\subset S} F(S) なので、包除原理から F(S) = \sum_{T\subset S} (-1)^|S\setminus T| G(T) が成り立つ。

求めるのは f(\emptyset)
= F({1, ..., n})
= \sum_{T\subset {1, ..., n}} (-1)^|{1, ..., n}\setminus T| G(T)
= \sum_{T\subset {1, ..., n}} (-1)^|{1, ..., n}\setminus T| g({1, ..., n} \setminus T)
= \sum_{T\subset {1, ..., n}} (-1)^|T| g(T)
（ T -> T\setminus {1, ..., n} で置換）
ここで g は size の関数なので g(T) = g(|T|) とおくと、 k 元集合の選び方が nCk 通りなので 
= \sum_{k=0}^n (-1)^k nCk g(k)
= \sum_{k=0}^n (-1)^k n! / (n-k)! / k! * (m-k)! / (m-n)!
となる。

これを高速に計算する。 k == 0 のとき m! / (m-n)! で、

    n! (m-k)!             n! (m-(k-1))!          n-k+1
---------------- == ------------------------ * ---------
(n-k)! k! (m-n)!    (n-(k-1))! (k-1)! (m-n)!   (m-k+1) k

なので、 k がふえるたびに (n-k+1) / (m-k+1) / k 倍すればよい
*/
ll inv_table[500001] = {};
void make_inv_table(int n){
    inv_table[1] = 1;
    for (int i=2; i<=n; ++i){
        // (MOD / i) * i + MOD % i = 0 なので
        // (MOD / i) * i = - (MOD % i)
        // - (MOD / i) * (MOD % i)^(-1) = i^(-1)
        inv_table[i] = inv_table[MOD%i] * (MOD - MOD / i) % MOD;
    }
}

int main()
{
    ll n, m;
    cin >> n >> m;

    const ll mpn = fact(m) * inv(fact(m-n)) % MOD;
    ll tmp = mpn;
    ll sum = tmp;
    const ll sign[2] = {1, MOD-1};
    make_inv_table(m);
    for(int k=1; k<=n; ++k){
        tmp = ((tmp * inv_table[m-k+1]) % MOD * (inv_table[k] * (n-k+1) % MOD)) % MOD;
        sum = (sum + sign[k%2] * tmp) % MOD;
    }
    cout << (sum * mpn) % MOD;
    return 0;
}


Measured memory_bytes: 7480
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i32 = read();
    println!("{}", 48 - n);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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 gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main(){
ll n,a,b,c,d,e;
cin>>n>>a>>b>>c>>d>>e;
ll tmp=min({a,b,c,d,e});
cout<<4+amarinasi(n,tmp)<<endl;
return 0;
}










Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>

int solve(int n, int k, const std::string &s) {
  int same = 0, len = s.length();
  for (int i = 1; i < len; ++i) {
    if (s[i] == s[i - 1]) ++same;
  }
  return same + std::min(len - 1 - same, 2 * k);
}

int main() {
  int n, k;
  std::string s;
  std::cin >> n >> k >> s;
  std::cout << solve(n, k, s) << std::endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

signed main() {
	int a, b, k;
	cin >> a >> b >> k;
	rep(i, k) {
		if (i % 2 == 0) {
			if (a % 2 == 1) a--;
			a /= 2;
			b += a;
		}
		else {
			if (b % 2 == 1) b--;
			b /= 2;
			a += b;
		}
	}
	cout << a << " " << b << endl;

	END;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#define _GLIBCXX_DEBUG
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <iomanip>
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
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; }
const int INF = 1001001000;
const int MOD = 1000000007;

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

using Graph = vector<vector<int>>;
//再帰とかグラフを使うときは予めNの最大値のグローバル配列を取っておく


//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

bool E[2005][2005];
vector<bool> seen;
typedef pair<int,int> P;
//typedef pair<string, int> P;
int D[2005];
//頂点状態を表すcolor[]において、0は未訪問、1は訪問中、2は完了を表す。
int color[101];
int find_time = 0;

int main() {
    int N, C, K; cin >> N >> C >> K;
    vector<int> time(N);
    for (int i = 0; i < N; i++) cin >> time.at(i);
    sort(time.begin(), time.end());
    int ans = 1;
    int sa = 0;
    int kyaku = 0;
    for (int i = 1; i < N; i++) {
        sa += time.at(i) - time.at(i - 1);
        kyaku++;
        if (sa > K || kyaku >= C) { 
            ans++; 
            sa = 0;
            kyaku = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>
#include<cstring>

using namespace std;

const int MAX=1e5+10;

int a[MAX];
int p[MAX];

long long mod_exp(int b){
	long long res,t;
	res=1;
	t=2;
	while(b){
		if(b&1){
			res=res*t%1000000007;
		}
		t=t*t%1000000007;
		b>>=1;
	}
	return res;
}

int main(){
	int n;
	cin>>n;
	memset(p,0,sizeof(p));
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		p[a[i]]++;
	}
	int cnt=0;
	bool flag=true;
	for(int i=0;i<n;i++){
		if((n+a[i]+1)%2!=0||(n-a[i]+1)%2!=0||(p[0]!=1&&n%2==1)||(p[a[i]]!=2&&a[i]!=0)){
			cout<<"0"<<endl;
			flag=false;
			break;
		}
		if(p[i]==2)
		cnt++;
	}
	if(flag)
	cout<<mod_exp(cnt)<<endl;
	return 0;
}

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

int main(){
	int x, i;
	
	i = 1;
	
	while(1){
		cin >> x;
		if(x == 0){
			break;
		}
		cout << "Case " << i << ": " << x << endl;
		i++;
	}
		return 0;
}

Measured memory_bytes: 3076
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int N;
    cin >> N;
    int c[N][3];
    rep(i, N) rep(j, 3) cin >> c[i][j];
    int dp[N+2][3];
    rep(i, 3) dp[0][i] = c[0][i];
    rep(i, N-1) rep(j, 3) dp[i+1][j] = max(dp[i][(j+1)%3], dp[i][(j+2)%3]) + c[i+1][j];
    cout << max(max(dp[N-1][0], dp[N-1][1]), dp[N-1][2]) << endl;



	return 0;
}


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

long long gcd(long long x, long long y){
  if (x<y) gcd(y,x);
  else if (y==0) return x;
  else gcd(y,x%y);
}


int main(){
  long long N, M;
  cin >> N >> M;
  string S, T;
  cin >> S >> T;
  long long check = gcd(N, M);
  long long L = N*M/check;
  long long i=0, j=0;
  while(i<N&&j<M){
    if (S[i]!=T[j]){
      cout << -1 << endl;
      return 0;
    }
    i+=N/check;
    j+=M/check;
  }
  cout << L << endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>

const int LIM = 1e3 + 5, INF = 1e9 + 7;

int n, m, s[LIM][LIM], f[LIM][LIM];
bool chk[LIM][LIM];

int solve(int i, int j, bool turn)
{
	if (i > m || j > n) return 0;
	
	if (chk[i][j]) return f[i][j];
	chk[i][j] = true;
	f[i][j] = -INF;
	
	int val, tmp;
	
	val = s[i][n] - s[i][j - 1] - s[i - 1][n] + s[i - 1][j - 1];
	tmp = solve(i + 1, j, !turn);
	if (!turn) f[i][j] = std::max(f[i][j], val - tmp);
	else f[i][j] = std::max(f[i][j], -val - tmp);
	
	val = s[m][j] - s[m][j - 1] - s[i - 1][j] + s[i - 1][j - 1];
	tmp = solve(i, j + 1, !turn);
	if (!turn) f[i][j] = std::max(f[i][j], -val - tmp);
	else f[i][j] = std::max(f[i][j], val - tmp);
	
//	printf("f %d %d = %d\n", i, j, f[i][j]);
	
	return f[i][j];
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i)
		for (int j = 1; j <= n; ++j)
		{
			scanf("%d", &s[i][j]);
			s[i][j] += s[i - 1][j];
			s[i][j] += s[i][j - 1];
			s[i][j] -= s[i - 1][j - 1];
		}
	printf("%d\n", abs(solve(1, 1, false)));
}


Measured memory_bytes: 11728
#include <vector>
#include <iostream>
#include <climits>
#include <functional>
using namespace std;

template <typename T>
struct SegmentTree{
private:
  using F = function<T(T,T)>;
  int n;
  F f;
  T ti;
  vector<T> dat;
public:
  SegmentTree(){};
  SegmentTree(F f,T ti) : f(f),ti(ti) {}
  void build(int n_){
    n = n_;
    dat.assign(2*n,ti);
  }
  void build(const vector<T> &v){
    int n_ = v.size();
    build(n_);
    for(int i = 0; i < n; ++i) dat[n+i]=v[i];
    for(int i = n-1; i >= 0; --i)
      dat[i]=f(dat[2*i+0],dat[2*i+1]);
  }
  void set_val(int k,T x){
    dat[k+=n] = x;
    while(k > 0){
      k = k/2;
      dat[k]=f(dat[2*k+0],dat[2*k+1]);
    }
  }
  T query(int a,int b){
    if(a == b) return ti;
    T vl = ti, vr = ti;
    for(int l = a+n, r = b+n; l < r; l >>= 1, r >>= 1){
      if(l&1) vl = f(vl,dat[l++]);
      if(r&1) vr = f(dat[--r],vr);
    }
    return f(vl,vr);
  }
};

void RMQ(){
  int n, q;
  cin >> n >> q;
  SegmentTree<int> rmq([](int a, int b){return min(a,b);}, INT_MAX);
  rmq.build(n);
  while(q--){
    int c, x, y;
    cin >> c >> x >> y;
    if(c){
      cout << rmq.query(x,y+1) << endl;
    }else{
      rmq.set_val(x,y);
    }
  }
}


void RSQ(){
  int n, q;
  cin >> n >> q;
  using T = long long;
  SegmentTree<T> rsq([](T a, T b){return a+b;},0LL);
  rsq.build(n);
  while(q--){
    int c, x, y;
    cin >> c >> x >> y;
    if(c){
      --x,--y;
      cout << rsq.query(x,y+1) << endl;
    }else{
      --x;
      long long t = rsq.query(x,x+1);
      rsq.set_val(x,t+y);
    }
  }
}

int main(){
  RMQ();
}



Measured memory_bytes: 3576
n=int(input())
alice=[]
bob=[]
l=list(map(int,input().split()))
while len(l)>0:
    alice.append(max(l))
    l.remove(max(l))
    if len(l)>0:
        bob.append(max(l))
        l.remove(max(l))

print(sum(alice)-sum(bob))


Measured memory_bytes: 3060
from collections import defaultdict
mod = 10**9+7
N = int(input())
S = input()
# N = 100000
# S = "qwertyuioasdfghjklzxcvbnm"


char_dict = defaultdict(int)
for s in S:
    char_dict[s] += 1

# print(char_dict)
char_list = list(char_dict.values())
char_num = len(char_list)
# print(char_num)
# print(char_list)

ans = 1
for i in char_list:
    ans *= i + 1
    ans %= mod

print(ans-1)


Measured memory_bytes: 3444
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n;
	int i = 1;
	int j = 1;
	vector<int> res;
	
	while(cin >> n && n != 0){
		int count = 0;
		while(j<n){
			int sum = 0;
			while(sum < n){
				sum += i;
				i++;
			}
			if(sum == n){
				count++;
			}
			j++;
			i = j;
		}
		i = 0;
		j = 1;
		res.push_back(count);
	}
	
	for(int i=0;i<res.size();i++){
		cout << res[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3052