akhauriyash/Code-Regression huggingface dataset:
a = ord("a")
A = ord("A")
dic1 = {}
dic2 = {}
for i in range(26):
  dic1[i] = chr(a + i)
  dic2[chr(a + i)] = i
  dic1[i + 26] = chr(A + i)
  dic2[chr(A + i)] = i + 26
while True:
  n = int(input())
  if n == 0:break
  klst = list(map(int, input().split())) * 100
  s = input()
  ans = ""
  for c, k in zip(s, klst):
    ans += dic1[(dic2[c] - k) % 52]
  print(ans)


Measured memory_bytes: 5812
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;
#include <iomanip>

int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;
  std::vector<long double> A(N);
  for(int i=0;i<N;i++) std::cin >> A[i];
  long double waru = 0;
  for(int i=0;i<N;i++) waru += 1.0/A[i];
  waru = 1.0/waru;
  std::cout << fixed << setprecision(20) << waru << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

int main(){
    int n,m,p;
    cin>>n>>m>>p;
    int a[m],b[m];
    ll c[m];
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--,b[i]--;
        c[i]=p-c[i];
    }
    ll d[n];
    fill(d,d+n,LINF);
    d[0]=0;
    bool flag=false,reach[n]={};
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(d[a[j]]!=LINF&&d[b[j]]>d[a[j]]+c[j]){
                d[b[j]]=d[a[j]]+c[j];
                if(i==n-1){
                    flag=true;
                    reach[a[j]]=reach[b[j]]=true;
                }
            }
        }
    }
    if(flag){
        for(int i=0;i<n-1;i++){
            for(int j=0;j<m;j++){
                reach[b[j]]|=reach[a[j]];
            }
        }
    }
    if(reach[n-1])cout<<-1<<endl;
    else cout<<max(0LL,-d[n-1])<<endl;
}


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

/*
#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")*/

#define I inline void 
#define S struct 
#define vi vector<int> 
#define vii vector<pair<int,int>>
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std ; 
using ll = long long ; 
using ld = long double ; 

const int N = 2e5 + 7 , mod = 1e9 + 7 ; 
const int inf = N ; 
// How interesting!

int n ;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<int> a(N , 0) , b(N , 0); 
int occ[N] , occ2[N] ; 
int mx1 , mx2;  

int ans[N] ; 

I check(){
        for(int i = 0 ;i < n ;i++){
                if(a[i] == b[i]){
                        return ; 
                }
        }
        cout<<"Yes\n"; 
        for(int i = 0 ;i < n;i++)
                cout<< b[i] <<" " ;
        exit(0) ;  
}

I shift(vector<int> &aux , int x){
        vector<int> tmp(n , 0) ; 
        for(int i = 0 ;i < n;i++){
                tmp[(i + x + n) %n] = aux[i] ; 
        }
        for(int i = 0 ;i < n;i++){
                aux[i] = tmp[i] ; 
        }
}

I make(int x){
        shift(b , x) ; 
        check() ; 
        shift(b , -x) ; 
}

int main(){
        ios_base::sync_with_stdio(0) ; 
        cin.tie(0) ;
        srand(time(0)) ; 
        //freopen("in.in" , "r" , stdin) ;
        cin >> n; 

        for(int i = 0 ;i < n;i ++ ){
                cin >> a[i] ; 
                mx1 = max(mx1 , ++occ[a[i]]) ; 
        }

        for(int i = 0 ;i < n;i++){
                cin >> b[i] ; 
                mx2 = max(mx2 , ++occ2[b[i]]) ; 
        }
        make(mx1) ; 
        make(mx2) ; 
        make(n - mx1) ; 
        make(n - mx2) ; 
        for(int i = 0 ;i < 1000000 / n;i ++){
                int x = rng() % n ; 
                make(x) ;
        }
        cout<<"No" ; 
        return 0 ; 
}

Measured memory_bytes: 7280
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(1){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
         if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,m;
	cin>>n>>m;
	long long k=n/m;
	long long ans1=abs(n-k*m);
	long long ans2=abs(n-(k+1)*m);
	printf("%lld",min(ans1,ans2));
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
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;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[300000];
int cnt[65];
int ans;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		for (int j = 0; j < 60; j++) {
			if (a[i] & ((int)1 << j))cnt[j]++;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 60; j++) {
			int k = ((int)1 << j) % mod;
			if (a[i] & ((int)1 << j)) {
				ans += k * (n - i - cnt[j]);
				cnt[j]--;
			}
			else {
				ans += k * cnt[j];
			}
			ans %= mod;
		}
	}
	cout << ans << endl;
}


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

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    int c[h][w], a[n];
    rep(i, h) rep(j, w) c[i][j] = 0;
    rep(i, n) cin >> a[i];

    bool right = true;
    int x = 0, y = 0;
    rep(i, n) {
        rep(j, a[i]) {
            c[y][x] = i + 1;
            if (right && x == w - 1 || !right && x == 0) {
                right = !right;
                y++;
            } else
                right ? x++ : x--;
        }
    }

    rep(i, h) {
        rep(j, w) {
            cout << c[i][j];
            if (j != w - 1) cout << ' ';
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 384
h, w = map(int, input().split())
area = [[0] * w for _ in range(h)]
s = [input() for _ in range(h)]

for i, row in enumerate(s):
    cnt = 0
    for j, x in enumerate(row):
        if x == "#":
            for k in range(j-cnt, j): area[i][k] = cnt
            cnt = 0
        else: cnt += 1
    for k in range(w-cnt, w): area[i][k] = cnt

for i in range(w):
    cnt = 0
    for j in range(h):
        x = s[j][i]
        if x == "#":
            for k in range(j-cnt, j): area[k][i] += cnt - 1
            cnt = 0
        else: cnt += 1
    for k in range(h-cnt, h): area[k][i] += cnt - 1

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, area[i][j])

print(ans)



Measured memory_bytes: 99804
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;


int main()
{
	string n;
	cin >> n;
	int s = 0;
	for (int i = 0; i < n.size(); ++i)
	{
		s += (n[i] - 48);
		s %= 9;
	}
	if (s)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    int m = A < B ? A : B;
    int cdiv = 0;
    for (int i = m; true; i--) {
        if (A % i == 0 && B % i == 0) cdiv++;
        if (cdiv == K) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, k, r, s, p int
	var t string
	fmt.Scan(&n, &k, &r, &s, &p, &t)

	v := map[byte]int{
		'r': p,
		's': r,
		'p': s,
	}

	tt := make(map[int]bool)
	ans := 0
	for i := 0; i < n; i++ {
		if i-k < 0 {
			ans += v[t[i]]
			continue
		}

		if t[i-k] == t[i] {
			if tt[i-k] {
				ans += v[t[i]]
			} else {
				tt[i] = true
			}
			continue
		}
		ans += v[t[i]]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2944
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=4e3+10;
char str[maxn];
int main()
{
	int n,a=0,b=0,c=0;
	scanf("%d",&n);
	scanf("%s",str+1);
	int len = strlen(str+1);
	
	for(int i=1;i<=len;i++)
	{
		if(str[i]=='R')
			a++;
		else if(str[i]=='G')
			b++;
		else
			c++;
	} 
	ll ans=1ll*a*b*c;
	for(int i=1;i<=len;i++)
	{
		for(int j=i+1;j<=len;j++)
		{
			int k=j+(j-i);
			if(k>len)
				break;
			if(str[i]!=str[j] && str[j]!=str[k] && str[k]!=str[i])
				ans--;
		}	
	}
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 3820
def negabinary(i):
    if i == 0:
        digits = ['0']
    else:
        digits = []
        while i != 0:
            i, remainder = divmod(i, -2)
            if remainder < 0:
                i, remainder = i + 1, remainder + 2
            digits.append(str(remainder))
    return ''.join(digits[::-1])


print(negabinary(int(input())))

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
b = [0] * n

s1 = 0
s2 = 0

for i in range(n):
    b[i] = a[i] - i
b.sort()

b1 = b[n//2]
b2 = b[n//2-1]

for i in range(n):
    s1 += abs(a[i] - b1 - i)

for i in range(n):
    s2 += abs(a[i] - b2 - i)

print(min(s1, s2))


Measured memory_bytes: 25200
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, k, s = na()

if s == 10**9:
    for i in range(k):
        print(10**9, end=" ")
    for i in range(n-k):
        print(1, end=" ")
else:
    for i in range(k):
        print(s, end=" ")
    for i in range(n-k):
        print(10**9, end=" ")


Measured memory_bytes: 4380
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <set>
#include <map>

using namespace std;

int n, m;
long xyz[1001][3];

long getScoreXYZ(long x, long y, long z)
{
    return abs(x) + abs(y) + abs(z);
}

long getScore(int idx, int p)
{
    long res = 0;
    for(int i=0; i<3; i++)
    {
        if(p & (1 << i)) res += xyz[idx][i];
        else res -= xyz[idx][i];
    }

    return res;
}

int main(){

    long ans = 0;
    cin >> n; cin >> m;

    for(int i=0; i<n; i++) for(int j=0; j<3; j++) cin >> xyz[i][j];

    for(int i=0; i<8; i++)
    {
        vector<long> vec;
        for(int j=0; j<n; j++)
        {
            vec.emplace_back(getScore(j, i));
        }
        sort(vec.begin(), vec.end(), greater<long>());

        long sum=0;
        for(int j=0; j<m; j++)
        {
            sum += vec[j];
        }
        ans = max(ans, sum);
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if V<=W:
    print("NO")
else:
    difAB = abs(A-B)
    difVW = V-W
    if difAB<=difVW*T:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 9100
def num_list(n):
    le = len(str(n))
    m = []
    for j in range(le):
        if j == le-1:
            m.append(n % 10)
        elif 0 < j < le-1:
            x = (n % (10 ** (le - j))) // (10 ** (le - j - 1))
            m.append(x)
        elif j == 0:
            m.append(n // (10 ** (le - 1)))
    return m


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

total = 0
for i in range(1, N+1):
    y0 = num_list(i)
    y = sum(num_list(i))
    if A <= y <= B:
        total += i
print(total)


Measured memory_bytes: 3064
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc161
{
    class Program
    {
        static void Main(string[] args)
        {
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
			solve_abc161A();
        }

        public static void solve_abc161B()
        {
        }

        public static void solve_abc161A()
        {
            int[] xyz = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine("{0} {1} {2}", xyz[2], xyz[0],xyz[1]);
        }
    }
}


Measured memory_bytes: 11220
#include <cmath>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

#define forsn(i,s,n) for (int i = (s);i < (int)(n);i++)
#define forn(i,n) forsn(i,0,n)
#define dforsn(i,s,n) for (int i = (n-1);i >= (int)(s);i--)
#define dforn(i,n) dforsn(i,0,n)
#define all(v) (v).begin(), (v).end()
#define F first
#define S second

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

	int a, b; cin >> a >> b;	
	if (a > 0) cout << "Positive" << endl;
	else if (b >= 0) cout << "Zero" << endl;
	else cout << ((b - a) % 2? "Positive" : "Negative") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int start = max(a,c);
	int end = min(b,d);
	if(end>start)
		printf("%d\n",end-start);
	else
		printf("0\n");
	return 0;
}

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

const ll mod = (ll) 1e9 +7;

ll dp[1005][1005];
char s[1005][1005];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int w,h;
	cin>>w>>h;
	
	for(int i=0;i<w;i++)
	for(int j=0;j<h;j++)
	cin>>s[i][j];
	
	dp[0][1] = 1;
	
	for(int i=1;i<=w;i++)
	{
		for(int j=1;j<=h;j++)
		{
			if(s[i-1][j-1]=='.')
			dp[i][j] = (dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
			
			else
			dp[i][j] = 0;
		}
	}
	
	cout<<dp[w][h]<<"\n";
	return 0;
}

Measured memory_bytes: 12416
data = [int(x) for x in input().strip().split()]

k = data[0]
s = data[1]

answer = 0;

for i in range(0, k + 1):
	for j in range(0, k + 1):
		if (s - i - j <= k and s - i - j >= 0):
			answer += 1
print(answer)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    int x[n];
    for(int i = 0;i<n;i++){
        cin >> x[i];
    }
    int tem = min(abs(x[0]) + abs(x[k-1] - x[0]),abs(x[k-1]) + abs(x[k-1] - x[0]));
    sort(x,x+n);
    for(int i = 0;i<n-k+1;i++){
        tem = min(tem,min(abs(x[i])+abs(x[i+k-1] - x[i]),abs(x[i+k-1]) + abs(x[i+k-1] - x[i])));
    }
    cout << tem << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

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

  cout << accumulate(p.begin(), p.end(), 0) - 0.5 * *max_element(p.begin(), p.end());
  cout << endl;

  return 0;
}


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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(int i= (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ld A, V, B, W, T; cin >> A >> V >> B >> W >> T;
    ld d = abs(A - B);
    ld s = V - W;

    if (s <= 0) {
        cout << "NO" << "\n";
    } else if (d / s <= T) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }
}

Measured memory_bytes: 3740
/*
 　　　　　／＞　 フ
 　　　　　| 　_　 _|
 　 　　　／`ミ _x 彡
 　　 　 /　　　 　 |
 　　　 /　  ヽ　　 ?
 　／￣|　　 |　|　|
 　| (￣ヽ＿_ヽ_)_)
 　＼二つ
  */

#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template<typename F>
inline void write(F x, char ed = '\n') {
    static short st[30];short tp=0;
    if(x<0) putchar('-'),x=-x;
    do st[++tp]=x%10,x/=10; while(x);
    while(tp) putchar('0'|st[tp--]);
    putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

int n;
inline void Add(int x, int y, int t) {
    if (t) write(x + n, ' '), write(y + n);
    else write(x, ' '), write(y);
}
int main() {
    read(n); int lim = 1;
    while (lim <= n) {
        if (lim == n) return puts("No"), 0;
        lim <<= 1;
    }
    puts("Yes");
    for (int i = 2;i <= 3; i++)
        Add(i - 1, i, 0), Add(i - 1, i, 1);
    write(n + 1, ' '), write(3);
    for (int i = 4;i < n; i += 2) 
        Add(i, i + 1, 0), Add(i + 1, 1, 0), Add(1, i, 1), Add(i + 1, i, 1);
    if (!(n & 1)) {
        for (int i = 2;i <= n; i++) {
            int tt = n ^ i ^ 1;
            if (i == 3 || tt > n) continue;
            if (tt & 1) swap(tt, i);
            Add(i, n, 0), Add(tt, n, 1);
            return 0;
        }
        return 0;
    }
    return 0;
}


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

const double EPS = 1e-8;
const double INF = 1e12;

//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
// line
struct L : public vector<P> {
	L(const P& a, const P& b) {
		push_back(a); push_back(b);
	}
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;								  // a--c--b on line
}

bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}
bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
         cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const L &l, const P &p) {
  return abs(cross(l[1]-p, l[0]-p)) < EPS;
}
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

P projection(const L &l, const P &p) {
	double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}
P reflection(const L &l, const P &p) {
	return p + (double)2 * (projection(l, p) - p);
}
double distanceLP(const L &l, const P &p) {
	return abs(p - projection(l, p));
}
double distanceLL(const L &l, const L &m) {
	return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double distanceLS(const L &l, const L &s) {
	if (intersectLS(l, s)) return 0;
	return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(const L &s, const P &p) {
	const P r = projection(s, p);
	if (intersectSP(s, r)) return abs(r - p);
	return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const L &s, const L &t) {
	if (intersectSS(s, t)) return 0;
		return min({distanceSP(s, t[0]), distanceSP(s, t[1]), distanceSP(t, s[0]), distanceSP(t, s[1])});
}
P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int main() {
	int q;
	cin >> q;
	for(int i=0; i<q; ++i) {
		double x[4], y[4];
		for(int j=0; j<4; ++j) cin >> x[j] >> y[j];
		P p1(x[1]-x[0], y[1]-y[0]), p2(x[3]-x[2], y[3]-y[2]);
		if(cross(p1, p2) == 0) cout << 2 << endl;
		else if(dot(p1, p2) == 0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3228
#include<stdio.h>
#define N 100

int main(){
  int i,j,u,n,k,v;
  int M[N][N];

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      M[i][j] = 0;
    }
  }

  for(i = 0;i < n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j = 0;j < k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      if(j){
	printf(" ");
      }
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2036
n, k = map(int, input().split())
s = input()

if n == 1:
    print(0)
    exit()

happy = 0
lchunk, rchunk = [], []
before = s[0]
if before == 'R' and s[1] == 'R':
    happy += 1
for i in range(1, n):
    si = s[i]

    if si != before:
        if before == 'L':
            if lchunk == [] and rchunk == []:
                lchunk.append(1)
            else:
                lchunk.append(2)
        else:
            if rchunk == [] and lchunk == []:
                rchunk.append(1)
            else:
                rchunk.append(2)
    
    if si == 'L' and s[i-1] == 'L':
        happy += 1
    if i < n-1:
        if si == 'R' and s[i+1] == 'R':
            happy += 1
    before = si
if s[-1] == 'L':
    lchunk.append(1)
else:
    rchunk.append(1)

lchunk.sort(reverse=True)
rchunk.sort(reverse=True)

if lchunk == [] or rchunk == []:
    print(happy)
else:
    print(max(happy+sum(lchunk[:k]), happy+sum(rchunk[:k])))

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, A, B, C, D;
std::string S;

bool has(int i){
    if(i < 0 || i >= N){
        return false;
    }

    return S[i] == '#';
}

bool go(int i, int j){
    while(i < j){
        if(i + 1 <= j && !has(i + 1)){
            i += 1;
        }else if(i + 2 <= j && !has(i + 2)){
            i += 2;
        }else{
            return false;
        }
    }

    return true;
}

bool can(){
    if(C < B){
        return go(A, C) && go(B, D);
    }else if(C < D){
        return go(A, C) && go(B, D);
    }

    while(has(B - 1) || has(B + 1)){
        if(B + 1 <= D && !has(B + 1)){
            B += 1;
        }else if(B + 2 <= D && !has(B + 2)){
            B += 2;
        }else{
            return false;
        }
    }

    S[B] = '#';
    
    return go(A, C) && go(B, D);
}

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

    std::cin >> N >> A >> B >> C >> D;
    std::cin >> S;
 
    A -= 1;
    B -= 1;
    C -= 1;
    D -= 1;

    if(can()){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 592
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<ctime>
using namespace std;
typedef long long ll;
const int N = 210;
ll read() {
	ll x = 0,f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1; c = getchar();
	}
	while(c >= '0' && c <= '9') {
		x = x * 10 + c - '0'; c = getchar();
	}
	return x * f;
}
int d[N][N],f[N][N],A,B,X[N],Y[N];
int main() {
	A = read(),B = read();
	
	for(int i = 1;i <= A;++i)
		for(int j = 1;j <= B;++j)
			d[i][j] = read();
	
	
	for(int i = 0;i <= 100;++i)
		for(int j = 0;j <= 100;++j)
			for(int x = 1;x <= A;++x)
				for(int y = 1;y <= B;++y)
					f[i][j] = max(f[i][j],d[x][y] - i * x - j * y);
	
	for(int x = 1;x <= A;++x) {
		for(int y = 1;y <= B;++y) {
			int tmp = 1e9;
			for(int i = 0;i <= 100;++i) {
				for(int j = 0;j <= 100;++j) {
					tmp = min(tmp,f[i][j] + i * x + j * y);					
				}
			}
			if(tmp != d[x][y]) return puts("Impossible"),0;
		}
	}
	
	
	
    puts("Possible");
    puts("202 10401");
    for(int i = 1 ; i <= 100 ; ++i)
    printf("%d %d X\n" , i , i + 1);
    for(int i = 102 ; i < 202 ; ++i)
    printf("%d %d Y\n" , i , i + 1);
    for(int i = 0 ; i <= 100 ; ++i)
    for(int j = 0 ; j <= 100 ; ++j)
        printf("%d %d %d\n" , 1 + i , 202 - j , f[i][j]);
    puts("1 202");

	return 0;
}


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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("2 1");
            //Brown
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("5 0");
            //Alice
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("0 0");
            //Brown
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("4 8");
            //Alice
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] wkArr = InputList[0].Split(' ').Select(A => long.Parse(A)).ToArray();
        long X=wkArr[0];
        long Y=wkArr[1];

        Console.WriteLine(Math.Abs(X - Y) <= 1 ? "Brown" : "Alice");
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

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

int main() {
    int N, M;
    cin >> N >> M;

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int  x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); // xの木とyの木を併合する
    }

    int cnt=0;
    for(int i=0;i<N;i++){
        if(!tree.same(0,i)){
            tree.unite(0, i);
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3736
// template version 1.13
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_pair(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int r;cin>>r;
  cout << r*r << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
const int N=2e5+10;
int n,V;
int A[N],L[20][N],R[20][N],Fl[1<<20],Fr[1<<20],G[N];
void Calc(int m,int d) {
  R[m][n]=n;
  for(int i=n-1;i;--i) {
    if(A[i+1]-A[i]<=d) R[m][i]=R[m][i+1];
    else R[m][i]=i;
  }
  L[m][1]=1;
  for(int i=2;i<=n;++i) {
    if(A[i]-A[i-1]<=d) L[m][i]=L[m][i-1];
    else L[m][i]=i;
  }
}
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,V);
  for(int i=1;i<=n;++i) read(A[i]);
  int mlog=0;
  while(V) Calc(mlog++,V),V>>=1;
  Calc(mlog,V);
  Fr[0]=n+1;
  for(int i=1;i<1<<mlog;++i) {
    Fr[i]=n;
    for(int j=0;j<mlog;++j) {
      if(i>>j&1) {
        Fl[i]=max(Fl[i],R[j+1][Fl[i^(1<<j)]+1]);
        Fr[i]=min(Fr[i],L[j+1][Fr[i^(1<<j)]-1]);
      }
    }
  }
  for(int i=0;i<1<<mlog;++i) {
    int l=Fl[i],r=Fr[((1<<mlog)-1)^i];
    int a=L[0][r-1],b=R[0][l+1];
    if(a<=b) ++G[a],--G[b+1];
  }
  for(int i=1;i<=n;++i) {
    G[i]+=G[i-1];
    puts(G[i]?"Possible":"Impossible");
  }
  return 0;
}


Measured memory_bytes: 39040
#include<stdio.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 200005;
const int MM = 924844033;

vector<int> R[MX], B[MX];

int dR[MX], dB[MX], P[MX][20];

int dfsB(int x, int p = -1){
	for(int c : B[x]){
		if( c == p ) continue;
		dB[c] = dB[x] + 1;
		dfsB(c, x);
	}
}

int dfs(int x, int p = -1){
	for(int c : R[x]){
		if( c == p ) continue;
		dR[c] = dR[x] + 1;
		P[c][0] = x;
		for(int t = 1; t < 20; t++) P[c][t] = P[P[c][t-1]][t-1];
		dfs(c, x);
	}
}

int dist(int a, int b){
	int ans = 0;
	if( dR[a] < dR[b] ) swap(a, b);
	for(int i = 0; i < 20; i++){
		if( (dR[a] - dR[b])&1<<i ) ans += 1<<i, a = P[a][i];
	}
	for(int i = 19; i >= 0; i--){
		if( P[a][i] != P[b][i] ) ans += 1<<i+1, a = P[a][i], b = P[b][i];
	}
	return ans + (a==b ? 0 : 2);
}

int win[MX];
int ans = 0;

void solve(int x, int p = -1){
	ans = max(ans, dR[x] * 2);
	if( win[x] ) ans = 1e9;
	for(int c : B[x]){
		if( c == p ) continue;
		if( dB[c] >= dR[c] ){
			ans = max(ans, dR[c] * 2);
			continue;
		}
		solve(c, x);
	}
}

int main()
{
	int N, X, Y;
	scanf("%d%d%d", &N, &X, &Y);
	for(int i = 1; i < N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		B[a].push_back(b);
		B[b].push_back(a);
	}

	for(int i = 1; i < N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		R[a].push_back(b);
		R[b].push_back(a);
	}
	dfs(Y);
	dfsB(X);
	for(int i = 1; i <= N; i++){
		for(int c : B[i]){
			if( dist(i, c) >= 3 ) win[i] = win[c] = 1;
		}
	}
	ans = dR[X] * 2;
	solve(X);
	if( ans == 1e9 ) printf("-1\n");
	else printf("%d\n", ans);
}


Measured memory_bytes: 48636
#include <stdio.h>
#define N 100

int main(){

  int i,j,k,A[N],length,v;

  scanf("%d",&length);
  
  for(i=0;i<length;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<length;i++){
    if(i==length-1)printf("%d",A[i]);
    else printf("%d ",A[i]);
  }
  printf("\n");
  
  for(i=1;i<length;i++){
    v = A[i];
    j = i-1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    
    for(k=0;k<length;k++){
      if(k==length-1)printf("%d",A[k]);
      else printf("%d ",A[k]);
    }
    printf("\n");
  }
  return 0;
}




Measured memory_bytes: 2068
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.append(0)
CA = [a for a in A]
for i in range(N):
    total = CA[i] + CA[i+1]
    if x < total:
        if CA[i + 1] <= (total - x):
            rest = total - x - CA[i + 1]
            CA[i + 1] = 0
            CA[i] -= rest
        else:
            CA[i + 1] -= total - x


cnt = 0
for a, ca in zip(A, CA):
    cnt += (a - ca)
print(cnt)


Measured memory_bytes: 14052
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n;
  cin >> n;
  vector<string> a(n); 
  rep(i,n) {
    string s;
    cin >> s;
    sort(All(s));
    a[i] = s;
  }
  sort(All(a));
  ll ans = 0;
  ll len = 1;
  rep(i,n-1) {
    if (a[i] == a[i+1]) {
      ++len;
    }
    else {
      ans += len*(len-1)/2;
      len = 1;
    }
  }
  ans += len*(len-1)/2;
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 6408
import java.util.*;
class Main{
	public static void main(String[] args)throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a==b){
			System.out.println("Draw");
		}else if(a==1){
			System.out.println("Alice");
		}else if(b==1){
			System.out.println("Bob");
		}else if(a>b){
			System.out.println("Alice");
		}else if(a<b){
			System.out.println("Bob");
		}
	}
}

Measured memory_bytes: 21972
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
}


Measured memory_bytes: 3580
#include <stdio.h>

int isprime(int n)
{
	for(int i = 2; i * i <= n; i++)
	{
		if(n % i == 0)
		{
			return 0;
		}
	}
	return 1;
}

int main()
{
	int p1[10000];
	int q1[10000];
	int n, i, cnt = 0;

	while(1)
	{
		scanf ("%d",&n);
		for(i=n; i!=0; i--)
		{
			if(isprime(i) == 1 && isprime(i-2) == 1)
			{
				p1[cnt] = i;
				q1[cnt] = i-2;
				break;
			}
		}
		if(n==0)
		{
			break;
		}
		cnt++;
	}
	for(i=0; i<cnt; i++)
	{
		printf("%d %d\n",q1[i],p1[i]);
	}
	return 0;
}

Measured memory_bytes: 2632
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();


int main() {
    int k = 0;
  	vector<int> arr(3, 0);
 	for(int& val: arr)
      cin >> val;
  	cin >> k;
  	sort(arr.begin(), arr.end());

    arr[2] = arr[2] << k;
  	cout << arr[0] + arr[1] + arr[2] << endl;
    return 0;
}


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

typedef pair<int,int> P;

int main() {
    int N, M;
    cin >> N >> M;
    vector<P> arm(M);
    for (int i = 0; i < M; i++) {
        cin >> arm[i].first >> arm[i].second;       
    }
    sort(arm.begin(), arm.end());

    vector<int> s1(N), s2(N);
    for(int i = 0; i < N; i++) s1[i] = 1, s2[i] = 1;

    for (int i = 0; i < M; i++) {
        int y = arm[i].second;

        s1[y-1] += s1[y];
        s1[y] = 0;
        s2[y] += s2[y-1];
        s2[y-1] = 0;
    }

    vector<int> sum(N+1);
    for (int i = 0; i < N; i++) {
        sum[i] += s1[i];
        sum[i+1] -= s2[i];
    }

    for (int i = 0; i < N-1; i++) {
        cout << sum[i] << " ";
        sum[i+1] += sum[i];
    }
    cout << sum[N-1] << endl;

    return 0;
}

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

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

    if(B-A<=2*K-2){
        for(int i=A; i<=B; i++){
            cout << i << endl; 
        }
        return 0;
    }
    else{
        for(int i=A; i<=A+K-1; i++){
            cout << i << endl;
        }
        for(int i=B-K+1; i<=B; i++){
            cout << i << endl;
        }
        return 0;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<chrono>
                             
using namespace std;
using namespace std::chrono;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
const ll mod=10000007;
const int MX=0x3f3f3f;

int main(){
    IOS;
    int a,b;
    cin>>a>>b;
    cout<<6-a-b<<"\n";
    return 0;
}

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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var line_input_one = System.Console.ReadLine();
            var line_input_two = System.Console.ReadLine();
            var split = line_input_two.Split(' ');
            var x = new int[split.Length];
            for(int i = 0; i < x.Length; i++)
            {
                x[i] = int.Parse(split[i]);
            }
            float avr = 0f;
            foreach(var xi in x)
            {
                avr += xi;
            }
            avr /= x.Length;
            var rouded = Math.Round(avr);
            double stsum = 0;
            foreach(var xi in x)
            {
                stsum += (xi - rouded) * (xi - rouded);
            }
            int result = (int)stsum;

            System.Console.WriteLine(result);
            System.Console.ReadLine();
        }
    }
}


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

int main()
{
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, s.size())
  {
    if (s[i] != t[i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3836
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  rep(i, m) cin >> x[i];
  sort(all(x));
  vector<int> dif;
  rep(i, m - 1) { dif.push_back(abs(x[i] - x[i + 1])); }
  sort(all(dif));

  if (n >= m)
    cout << 0 << endl;
  else {
    int ans = 0;
    rep(i, m - n) { ans += dif[i]; }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 2168
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=300005;
int n,B,W,a[N],S[N];
bool check(int v){
	int mn=0;
	for (int i=2;i<n;i+=2)
		if (mn+v<=S[i-1]) mn=min(mn,S[i]);
	return mn+v<=S[n];
}
int main(){
	scanf("%d",&n);
	For(i,1,n){
		scanf("%d",&a[i]);
		S[i]=S[i-1];
		if (i&1) B+=a[i],S[i]+=a[i];
		else W+=a[i],S[i]-=a[i];
	}
	if (!(n&1)){
		if (W>B) swap(W,B);
		printf("%d %d\n",B,W);
	}
	else{
		int l=-1e9,r=1e9,ans;
		while (l<=r){
			int mid=(l+r+1)/2;
			if (check(mid))
				ans=mid,l=mid+1;
			else r=mid-1;
		}
		ans=max(B,W+ans);
		printf("%d %d\n",ans,B+W-ans);
	}
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        public static List<long> GeneratePrime(long max)
        {
            long prime;
            double sqrtMax = Math.Sqrt(max);
            var primeList = new List<long>();

            List<long> searchList = new List<long>();
            for (long i = 2; i <= max - 1; i++)
            {
                searchList.Add(i);
            }

            do
            {
                prime = searchList.First();
                primeList.Add(prime);
                searchList.RemoveAll(n => n % prime == 0);
            } while (prime < sqrtMax);

            primeList.AddRange(searchList);

            return primeList;
        }

        void Omame()
        {
            cin = new Scanner();
            long N = cin.nextLong();

            long count = 0;
            for (int i = 0; i < N; i++)
            {
                long a = cin.nextLong();
                while(a % 2 == 0)
                {
                    a /= 2;
                    count++;
                }
            }

            Console.WriteLine(count);
        }

    }
}


Measured memory_bytes: 11744
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) (x.begin()),(x.end())
#define allr(x) (x.rbegin()),(x.rend())
#define sz(x)  ((ll)x.size())
#define FAST_IO ios_base :: sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
using namespace std;
#ifdef LOCAL
#include "uj.h"
#endif


void tokenize(string str,const char delim,vector<string> & res){
	stringstream p(str);
	string token;
	while(getline(p,token,delim)){
		res.push_back(token);
	}
	return;
}
// Your workSpace ...

const int inf = 1e9;
int n;

void test_case(){
    cin>>n;
    vector<int> v(n);
    for(auto & el : v)
        cin>>el;
    vector<long> dp(n+3,inf);
    dp[0] = 0;
    for(int i  = 1;i<n;++i){
        for(int j = 1;j<=2;++j)
            if(i-j>=0) dp[i] = min(dp[i],dp[i-j] + abs(v[i]-v[i-j]));
    }
   // debug() << owo(dp);
    cout<<dp[n-1]<<endl;
    return;
}




int main(){
	FAST_IO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif
	int tt;
//	cin>>tt;
tt = 1;
	for(int i = 0;i<tt;++i)
	    test_case();
#ifndef ONLINE_JUDGE
 	cerr << "Running Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}

Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
int main(){
int x,n,o=0,k,p;
cin>>x>>n;
int z=x+1,l=x-1;
int y[n];
if (n==0)
    cout<<x;
else{
for(int i=0;i<n;i++)
cin>>y[i];
sort(y,y+n);
for(int i=0;i<n;i++){
if(x!=y[i])
o++;
else{
k=p=i;
break;}
}
int u;
if(n-k>=k)
    u=k;
else
    u=n-k;
if (o==n)
cout<<x;
else
for(int i=0;i<n;i++){
k--;
p++;
if(y[k]!=l){
cout<<l;
i++;
break;
}
else if(y[p]!=z){
cout<<z;
i++;
break;}
else{
z++;
l--;
}
}
}
return 0;
}


Measured memory_bytes: 3668