akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  int N;
  N = S.size();
  cout << S[0] << N-2 << S[N-1] << endl;
  return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

ldbl distance(lpair p1, lpair p2) {
	ldbl x = p1.first - p2.first;
	ldbl y = p1.second - p2.second;

	return 1.0l * sqrtl(x*x + y*y);
}

int main() {
	llong N;
	vector<lpair> pos;

	cin >> N;
	pos.resize(N);
	for (auto &p: pos) {
		cin >> p.first >> p.second;
	}

	vector<llong> perm(N);
	for (int i = 0; i < N; ++i)
		perm[i] = i;

	ldbl ans = 0;
	llong cnt = 0;
	do {
		++cnt;
		for (int i = 1; i < N; ++i) {
			ans += distance(pos[perm[i]], pos[perm[i-1]]);
		}
	} while (next_permutation(ALL(perm)));


	cout << fixed << setprecision(30) << ans/cnt << endl;

	return 0;
}

Measured memory_bytes: 256
# 2019-11-28 00:55:58(JST)
import sys
import numpy as np

def main():
    n = int(sys.stdin.readline().rstrip())
    ab = np.array(sys.stdin.read().split(), dtype=np.int64)
    a = ab[:n]
    b = ab[n:]

    res = np.sort(a - b)
    if res.sum() < 0:
        print(-1)
        sys.exit()

    negative_cnt = np.sum(res < 0)
    if not negative_cnt:
        print(0)
        sys.exit()

    negative_sum = np.sum(res[:negative_cnt])
    positive_cnt = 0
    for i in range(n-1, -1, -1):
        negative_sum += res[i]
        positive_cnt += 1
        if negative_sum >= 0:
            break
    cnt = positive_cnt + negative_cnt

    print(cnt)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 42680
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(void){
	char arr[3][3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin >> arr[i][j]; //横に入っていく
		}
	}

	cout << arr[0][0] << arr[1][1] << arr[2][2] << endl;


	return 0;
}

Measured memory_bytes: 256
s = gets.chomp

ans = true
ans &&= s.start_with?('A')
subed = s.sub(/\A../, '').sub(/.\z/, '')
c_cnt = subed.count('C')
ans &&= c_cnt == 1
ans &&= s.sub(/A/, '').sub(/C/, '') =~ /\A[a-z]+\z/
puts ans ? 'AC' : 'WA'


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

int binpow(int n, int k) {
    if (k == 0) return 1;
    if (k == 1) return n;
    if (k % 2 == 0) {
        int nn = binpow(n, k / 2);
        return nn*nn;
    }
    if (k % 2 == 1) {
        return n * binpow(n, k - 1);
    }
}

void solve() {
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    
}

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


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

int main() {
  int N, M, C, A, S=0, count=0;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i=0; i<M; i++) {
    cin >> B[i];
  }
  for (int i=0; i<N; i++) {
    S=0;
    for (int j=0; j<M; j++) {
      cin >> A;
      S+=A*B[j];
    }
    S+=C;
    if (S>0) {
      count++;
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 3624
N,M,C = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in  range(N):
	a = list(map(int,input().split()))
	s = 0
	for j in range(M):
		s += a[j]*b[j]
	if s+C>0:
		count+=1
print(count)

Measured memory_bytes: 3064
import java.util.*;
import java.util.Map.Entry;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		HashMap<String,Integer> map=new HashMap<>();
		String[] str=in.nextLine().split(" ");
		
		for(int i=0;i<str.length;i++) {
			if(map.containsKey(str[i]))map.put(str[i], map.get(str[i])+1);
			else map.put(str[i],1);
		}
		
		String MUkey="",MLkey="";
		int MUN=0,MLN=0;
		for(Iterator<Map.Entry<String, Integer>> itr=map.entrySet().iterator();itr.hasNext();) {
			Map.Entry<String,Integer> etr=(Map.Entry<String, Integer>) itr.next();
			String s=etr.getKey();
			if(s.length()>MLN) {
				MLN=s.length();
				MLkey=s;
			}
			
			int u=etr.getValue();
			if(u>MUN) {
				MUN=u;
				MUkey=s;
			}
		}
		
		System.out.println(MUkey+" "+MLkey);
	}

}


Measured memory_bytes: 25832
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<int,int> P;
const int mod = 1e9+7;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a){
        (x+=a.x)%=mod;
        return *this;
    }
    mint& operator-=(const mint a){
        (x-=mod-a.x)%=mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x)%= mod;
        return *this;
    }
    mint operator+(const mint a)const{
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a)const{
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a)const{
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
      if(!t)return 1;
      mint a = pow(t>>1);
      a*=a;
      if(t%1)a*=*this;
      return a;
    }

    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a){
      return (*this) *= a.inv();
    }
    mint operator/(const mint a)const{
      mint res(*this);
      return res/=a;
    }
};

struct combination{
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i<n;++i)fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i>=1;--i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if(k<0 || k>n)return 0;
    return fact[n] * ifact[k] + ifact[n-k]; 
  }
};

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n),b(n);
    rep(i,n)cin >> a[i];
    b[0] = 0;
    rrep(i,n-1){
        b[i]=b[i-1] + a[i]-a[i-1];
    }
    // rep(i,n)cout << b[i]<<" ";
    // cout << endl;
    ll ans = INF;
    rep(i,n-k+1){
        int r = i+k-1;
        // if(r<0||a[i]>0)continue;
        ll tmp = 0;
        tmp = b[r]-b[i];
        // cout << tmp <<endl;
        tmp +=min((ll)abs(a[i]),(ll)abs(a[r]));
        ans = min(tmp,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
// #define f first
// #define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

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

  ll ans = 0;

  for (ll i = 1; i * i <= N - 1; i++) {
    if (i * i == N - 1) {
      ans++;
      break;
    } else if ((N - 1) % i == 0) {
      ans += 2;
    }
  }
  ans -= 1;

  for (ll i = 2; i * i <= N; i++) {
    if (N % i != 0)
      continue;
    else if (i * i == N) {
      ans += 1;
      continue;
    }
    ll Ntemp = N;
    while (Ntemp >= i) {
      if (Ntemp % i == 0)
        Ntemp /= i;
      else
        Ntemp %= i;
    }
    if (Ntemp == 1)
      ans++;
    Ntemp = N;
    ll j = N / i;
    while (Ntemp >= j) {
      if (Ntemp % j == 0)
        Ntemp /= j;
      else
        Ntemp %= j;
    }
    if (Ntemp == 1)
      ans++;
  }

  cout << ans + 1 << endl;

  return 0;
}

Measured memory_bytes: 256
def solve(n, H):
    if n == 1:
        return True

    L = [0] * n
    L[0] = H[0]
    for i in range(1, n):
        L[i] = max(L[i - 1], H[i])

    R = [0] * n
    R[-1] = H[-1]
    for i in range(n - 2, -1, -1):
        R[i] = min(R[i + 1], H[i])

    for i in range(n):
        if L[i] - R[i] > 1:
            return False

    return True


n = int(input())
H = list(map(int, input().split()))

if solve(n, H):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14400
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, t = 0;
	int t2 = 0;
	int a = 0;
	int b = 0;
	int c = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		if (s == "Y") {
			t++;
		}
		else if (s == "P") {
			a++;
		}
		else if (s == "W") {
			b++;
		}
		else if (s == "G") {
			c++;
		}
	}
	if (t > 0&&a+b+c+t==n&&a>0&&b>0&&c>0) {
		cout << "Four" << endl;
	}
	else if(a + b + c== n && a>0 && b>0 && c>0) {
		cout << "Three" << endl;
	}
	//system("pause");
}

Measured memory_bytes: 256
// Problem : E - Red Scarf
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout<<#x<<"="<<x<<endl
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define rep2(i,a,b) for(int i = a; i >= b; i--)
#define die return 0;

using namespace std;

typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;

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

int testcases;
testcases=1;
//cin>>testcases;

while(testcases--)
{
	int n;
	cin>>n;
	vector<int> vec(n);
	rep(i,0,n-1)
		cin>>vec[i];
	int tot=0;
	rep(i,0,n-1)
		tot=tot^vec[i];
	rep(i,0,n-1)
		vec[i]=vec[i]^tot;
	rep(i,0,n-1)
		cout<<vec[i]<<" ";
	cout<<'\n';
}

return 0;
}


Measured memory_bytes: 4780
//============================================================================
// Name        : d.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int n;cin>>n;
	long long a[n][n];
	long long b[n][n];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
			b[i][j]=a[i][j];
		}
	}
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(b[i][j]>b[i][k]+b[k][j]){
					b[i][j]=b[i][k]+b[k][j];
				}
			}
		}
	}
//	for(int i=0;i<n;i++){
//		for(int j=0;j<n;j++){
//			cout<<b[i][j];
//		}
//		cout<<endl;
//	}
	long long ans=0;
	int flag=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i!=j){
				if(a[i][j]>b[i][j]){
					flag=0;
					break;
				}
				int sumflag=1;
				for(int k=0;k<n;k++){
					if(k!=i&&k!=j){
//						cout<<i<<j<<k<<endl;
						if(b[i][j]==b[i][k]+b[k][j]){
							sumflag=0;
							break;
						}
					}
				}
				if(sumflag){
					ans+=a[i][j];
				}
			}
		}
	}
	if(flag){
		cout<<ans/2<<endl;
	}else{
		cout<<"-1"<<endl;
	}


	return 0;
}

Measured memory_bytes: 1664
//
//  main.cpp
//  pB
//
//  Created by Hsiu-Fen Chou on 2019/8/30.
//  Copyright © 2019 Hsiu-Fen Chou. All rights reserved.
//

#include <iostream>
using namespace std;
int main() {
    int K, X;
    
    while (cin >> K >> X) {
        if (K==1)
            cout << X << endl;
        else {
            for (int i=X-K+1; i<X+K-1; i++)
                cout << i << " ";
            cout << X+K-1 << endl;
        }
    }
    return 0;
}


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

using ll = long long;

constexpr int MAX_N = 2*1e5;
int A[MAX_N];

int main() {
  int N; cin >> N;
  for (int i{}; i < N; ++i) cin >> A[i];

  ll ans{};
  ll sum{};
  int right{};
  for (int left{}; left < N; ++left) {

    while (right < N
      // rightを1進めるための満たすべき条件
      && sum + A[right] == (sum ^ A[right])
        ) {
      // 条件更新となる処理
      sum += A[right];
      ++right;
    }

    // 条件を満たすright取得時の処理
    ans += (right - left);

    if (left == right) {
      ++right;
    } else {
      // leftを1進めるときの処理
      sum -= A[left];
    }
  }

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


Measured memory_bytes: 1152
import numpy as np
from itertools import product
 
h, w, k = map(int, input().split())
grid = np.array([list(map(str, input().rstrip())) for _ in range(h)])
 
ans = 0
for i in np.array(list(product([0, 1], repeat=h)), dtype=np.bool):
    for j in np.array(list(product([0, 1], repeat=w)), dtype=np.bool):
        if np.any(i) and np.any(j):
            arr = grid[i].copy()
            arr = arr[:, j]
            arr = arr.flatten()
            if np.where(arr == "#")[0].shape[0] == k:
                ans += 1
 
print(ans)

Measured memory_bytes: 27184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tsolve int t;cin>>t;while(t--)  solve();
#define f(i,n)   for(int i=0;i<n;i++)
#define ff first
#define all(a) a.begin(),a.end()
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pi>
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<double> a(n);
    f(i,n)  cin>>a[i];
    double s=accumulate(all(a),0);
    s/=n;
    f(i,n)  a[i]=abs(a[i]-s);
    double j=*min_element(all(a));
    f(i,n){
        if(a[i]==j){ 
            cout<<i;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std ;
template< class T > inl T read() {
	T x = 0 ; int f = 1 ; char k = getchar() ;
	for( ; k > '9' || k < '0'; k = getchar() ) if( k == '-' ) f = -1 ;
	for( ; k >= '0' && k <= '9'; k = getchar() ) x = x * 10 + k - '0' ;
	return x * f ;
}
template< class T > inl T read( T &x ) { return x = read<T>() ; }
int _num, _buf[20];
template< class T > il print( T x ) {
   	if( x == 0 ) return putchar( '0' ) ,void() ;
	if( x < 0 ) putchar( '-' ), x = -x ;
	while( x ) _buf[++_num] = x % 10, x /= 10 ;
	while( _num ) putchar( _buf[_num--] + '0' ) ;
}
ll mul( ll a, ll b, ll mod ) { long double c = 1. ; return ( a * b - (ll)( c * a * b / mod ) * mod ) % mod ; }
it qpow( int x, int m, int mod ) {
	int res = 1, bas = x ;
	while(m) {
		if( m & 1 ) res = ( 1ll * res * bas ) % mod ;
		bas = ( 1ll * bas * bas ) % mod, m >>= 1 ;
	}
	return res ;
}
const int mod = 998244353 ;
it add( int x ,int y ) {
	return x + y >= mod ? x + y - mod : x + y ;
}
it mul( int x, int y ) {
	return 1ll * x * y % mod ;
}
il inc( int &x, int y ) {
	 x = add( x, y ) ;
}
const int N = 3e3 + 5 ;
int n, S, val[N], f[N][N];
int main() {
//	freopen( ".in", "r", stdin ) ;
//	freopen( ".out", "w", stdout ) ;
	n = read<int>(), S = read<int>() ;
	for( ri i = 1; i <= n; ++i )
		val[i] = read<int>() ;
	f[0][0] = 1 ;
	for( ri i = 1; i <= n; ++i ) {
		for( ri j = 0; j <= S - val[i]; ++j )
			f[i][j + val[i]] = f[i - 1][j] ;
		for( ri j = 0; j <= S; ++j )
			inc( f[i][j], mul( f[i - 1][j], 2 ) ) ;
	}
	print( f[n][S] ), puts( "" ) ;
	cerr << 1. * clock() / CLOCKS_PER_SEC << "\n" ;
	return 0;
}

Measured memory_bytes: 39008
#include<iostream>
using namespace std;
#include<cstdio>
#include<cmath>

struct Point{ double x, y; };

Point set_p(double a, double b)
{
    Point p;
    p.x = a; p.y = b;
    return p;
}

struct Vector{ double vx, vy; };

Vector set_v(const Point &p1, const Point &p2)
{
    Vector v;
    v.vx = p2.x - p1.x;
    v.vy = p2.y - p1.y;
    return v;
}

double dot(const Vector &v1, const Vector &v2)
{
    return (v1.vx * v2.vx) + (v1.vy * v2.vy);
}

double cross(const Vector &v1, const Vector &v2)
{
    return (v1.vx * v2.vy) - (v1.vy * v2.vx);
}

double cross0(const Point &P0, const Point &P1)
{
	return (P0.x * P1.y) - (P1.x * P0.y);
}

double onenorm(const Vector &v)
{
    return abs(v.vx) + abs(v.vy);
}

double norm(const Vector &v)
{
	return sqrt(v.vx * v.vx + v.vy * v.vy);
}

int ccw(const Point &P0, const Point &P1, const Point &P2)
{
    Vector V1 = set_v(P0, P1);
    Vector V2 = set_v(P0, P2);
    double c = cross(V1, V2);
    if(c > 0){ return 1; }else if(c < 0){ return -1; }
    if(dot(V1, V2) < 0){ return -2; }
    if(onenorm(V1) < onenorm(V2)){ return 2; }
    return 0;
}

inline int sign(const double a){ if(a != 0){ return (a > 0 ? 1 : -1); } return 0; }

int main()
{
    int i, j, n;
    double *X, *Y;
    scanf("%d", &n);
    X = new double [n + 1];
    Y = new double [n + 1];
    for(i = 0; i < n; i++){
        scanf("%lf %lf", &X[i], &Y[i]);
    }
    X[n] = X[0], Y[n] = Y[0];
    Point *Polygon;
    Polygon = new Point [n + 1];
    for(i = 0; i <= n; i++){
        Polygon[i] = set_p(X[i], Y[i]);
    }
    int q; double x, y;
    scanf("%d", &q);
    Point P;
    Vector U, V;
    int a;
    bool is_inside;

    for(i = 0; i < q; i++){
        scanf("%lf %lf", &x, &y);
        P = set_p(x, y);
        U = set_v(P, Polygon[0]);
        a = 0;
        is_inside = false;
        for(j = 0; j < n; j++){
            V = set_v(P, Polygon[j + 1]);
            a = sign(cross(U, V));
            if(a != 0){
                if((a > 0 && U.vy <= 0 && V.vy > 0) || (a < 0 && V.vy <= 0 && U.vy > 0)){ is_inside = !is_inside; }
            }else{
                if(dot(U, V) <= 0) break;
            }
            U = V;
        }
        if(j < n){ printf("1\n"); }
        else{
            printf("%d\n", (is_inside ? 2 : 0));
        }
    }
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)

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

const int MAX = 1e5;
const int INF = 1e9;
const int MOD = 1e9 + 7;

string S;

int main(){
    cin >> S;

    if (S == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (S == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (s == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N, L;
    cin >> N >> L;
    vector<ll> a(N);
    int index = -1;
    rep(i, N) {
        cin >> a[i];
    }

    rep(i, N - 1) {
        if (a[i] + a[i + 1] >= L) {
            index = i;
        }
    }

    if (index == -1) {
        cout << "Impossible" << endl;
    }
    else {
        cout << "Possible" << endl;
        rep(i, index) {
            cout << i + 1 << endl;
        }
        for (int i = N - 1; i > index + 1; i--) {
            cout << i << endl;
        }
        cout << index + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
bool check(string s)
{
    //cout << "string " << s << endl;
    string temp = s;
    reverse(s.begin(), s.end());
    return temp == s;
}
int main()
{
    Hello
    string s;
    cin >> s;
    if(check(s) && check(s.substr(0, (s.size() - 1)/2)) &&
       check(s.substr(((s.size() + 3)/2) - 1)))
        cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
//int dx[]={+1,-1,+0,+0};///Four Directions
//int dy[]={+0,+0,+1,-1};///Four directions
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions

//int mark[10007];vi prime;void seive(){for(int i=2;i<10000;i++){if(mark[i]==0){prime.pb(i);for(int j=i+i;j<=10000;j+=i)mark[j]=1;}}}

//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll x; cin>>x;

    ll res=(x/500)*1000;
    x%=500;
    res+=(x/5)*5;
    cout<<res<<endl;
    End;
}


Measured memory_bytes: 256
import javax.swing.*;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        int[] arr = new int[count];
        int[] values = new int[count];
        for(int i = 0; i < count; i++) {
            arr[i] = sc.nextInt();
            values[i] = -1;
        }
        int answer = calculate(count - 1, arr, values);
        System.out.println(answer);
    }

    private static int calculate(int answerPos, int[] arr, int[] values) {
        if (answerPos == 0) {
            return 0;
        }

        if (values[answerPos] != -1) {
            return values[answerPos];
        }
        int answer;
        int a = Math.abs(arr[answerPos] -  arr[answerPos - 1]) + calculate(answerPos - 1, arr, values);
        if (answerPos == 1) {
            answer = a;
        } else {
            int b =  Math.abs(arr[answerPos] - arr[answerPos - 2]) + calculate(answerPos - 2, arr, values);

            if (a > b) {
                answer = b;
            } else {
                answer = a;
            }
        }
        values[answerPos] = answer;
        return answer;
    }
}

Measured memory_bytes: 61084
#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 R, G, B, N;
  cin >> R >> G >> B >> N;
  int ans = 0;
  rep(i, 3001)
  {
    rep(j, 3001)
    {
      int v = i * R + j * G;
      if (N >= v && (N - v) % B == 0)
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int x[100];

int main(){
	int N, M, a, i,b;
	cin >> N >> M;
	for(i = 0; i < M; i++){
		cin >> a >> b;
		x[a]++;
		x[b]++;
	}
	for(i = 1; i <= N; i++){
		cout << x[i];
		cout << "\n";
	}
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
#define mod 1000000007
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
ll nlcm(vector<ll> numbers) {
    ll res;
    res = numbers[0];
    for (ll i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}
int main() {
    ll n; cin >> n; vector<ll> t(n);
    rep(i, n) cin >> t[i];
    cout << nlcm(t) << endl;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll n,c;
  cin >> n >> c;
  vpl x(n);
  REP(i, n)
    cin >> x[i].FI >> x[i].SE;

  sort(x.begin(), x.end());
  vll utcw(n+1), utccw(n+1);
  vll stcw(n+1), stccw(n+1);

  REP(i, n){
    if(i==0){
      utcw[i+1] = utcw[i]+x[i].SE-x[i].FI*2;
      stcw[i+1] = stcw[i]+x[i].SE-x[i].FI;
    }
    else{
      utcw[i+1] = utcw[i]+x[i].SE-(x[i].FI-x[i-1].FI)*2;
      stcw[i+1] = stcw[i]+x[i].SE-(x[i].FI-x[i-1].FI);
    }
  }


  REP(i, n){
    if(i==0){
      utccw[i+1] = utccw[i]+x[n-1-i].SE-(c-x[n-1-i].FI)*2;
      stccw[i+1] = stccw[i]+x[n-1-i].SE-(c-x[n-1-i].FI);
    }
    else{
      utccw[i+1] = utccw[i]+x[n-1-i].SE-(x[n-i].FI-x[n-i-1].FI)*2;
      stccw[i+1] = stccw[i]+x[n-1-i].SE-(x[n-i].FI-x[n-i-1].FI);
    }
  }


  REP(i, n){
      utcw[i+1] = max(utcw[i+1],utcw[i]);
      utccw[i+1] = max(utccw[i+1],utccw[i]);
      stcw[i+1] = max(stcw[i+1],stcw[i]);
      stccw[i+1] = max(stccw[i+1],stccw[i]);
  }


  ll ans = 0;
  REP1(i, n+1){
    ans = max(ans,stcw[i]+utccw[n-i]);
    ans = max(ans,stccw[i]+utcw[n-i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4992
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int a[]  = {0,31,28,31,30,31,30,31,30,31,31,30,31};
    int m;
    int d;
    cin >> m;
    cin >> d;
    int aa,aaa;
    cin >> aa;
    cin >> aaa;
    cout << (a[m]== d) <<endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>
#include <queue>
#include <map>

using namespace std;

int main()
{
	int A, B;

	cin >> A;
	cin >> B;

	int fst = 0;
	fst = max(A,B);

	if (A > B) {
		A = A - 1;
	}
	else {
		B = B - 1;
	}

	int scd = 0;
	scd = max(A, B);

	cout << fst + scd << endl;

}

Measured memory_bytes: 256
x = int(input())
if 400 <= x < 600:
    print(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)

Measured memory_bytes: 9132
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int n; cin >> n;
  vector<int> dp(n+10, INF);
  vector<int> h(n);

  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
    dp[i+2] = min(dp[i+2], dp[i] + abs(h[i]-h[i+2]));
  }

  cout << dp[n-1] << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,j,x=0,n,k,y,c=0;
    cin>>n;
    for( int i=1;i<=n;i++)
    {
        c=0;
        for(j=i;j>0;j=j/10)
        {
            c++;
        }
        if(c%2!=0)
            x++;
    }
       cout<<x<<endl;
    return 0;
}



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

using namespace std;
typedef long long ll;

int gcd(int a, int b) {
  return (b ? gcd(b, a % b) : a);
}

int main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int num = n / gcd(n, m), ans = 0;
  for (int i = 0; i < num; i++) {
    int mina = 101, maxa = -1;
    for (int j = 0; j < m; j++) {
      int now = (i * m + j) % n;
      mina = min(mina, a[now]);
      maxa = max(maxa, a[now]);
    }
    ans += maxa - mina;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3112
#include <stdio.h>
 
int main () 
{
int a,b,n;
int count = 0;
scanf("%d %d %d",&n,&a,&b);

for(int i=1;i<n+1;i++)
{
    int x = i; 
    int sum = 0;
    while(x != 0)
    {
        sum += x%10;
        x /= 10;
    }
    
    if(a <= sum && sum <= b)
    {
        count += i;
    }
}
printf("%d",count);
return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] nums = new int[n];
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

       for(int i = 0; i <  nums.length; i++){
           String result = "node " + (i+1) + ": "
                   + "key = " +  nums[i] + ", ";
           StringBuilder stringBuilder = new StringBuilder(result);
           if(i != 0){
               stringBuilder.append("parent key = "
                       +  nums[(i-1)/2] + ", ");
           }

           if(2 * i + 1 < nums.length){
               stringBuilder.append("left key = " +  nums[2 * i + 1]
                       + ", ");
           }

           if(2 * i + 2 < nums.length){
               stringBuilder.append("right key = " +  nums[2*i+2] + ", ");
           }
           System.out.println(stringBuilder.toString());
       }
    }
}


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


def insertionSort(A, n, g):
    cnt = 0
    for i in range(g, n):
        v = A[i]
        j = i - g

        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

    return cnt


def shellSort(A, n):
    cnt = 0
    m = 1
    G = []
    while True:
        if n < int((3 ** m - 1) / 2):
            m -= 1
            break
        else:
            G.append(int((3 ** m - 1) / 2))
            m += 1

    G.reverse()

    for i in range(m):
        cnt += insertionSort(A, n, G[i])

    print_line(A, G, m, cnt)


def print_line(A, G, m, cnt):
    print(m)
    for i in range(len(G)):
        if i == len(G) - 1:
            print(G[i])
        else:
            print("{0}".format(G[i]), end=' ')
    print(cnt)
    for i in range(len(A)):
        print(A[i])

A = []
n = int(input())
for i in range(n):
    A.append(int(input()))

shellSort(A, n)


Measured memory_bytes: 45512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll bg=pow(10,9)+7;
#define pb push_back
int main()
{
  ll i,j,k,n;
  cin>>n>>k;
  vector<ll>arr;
  for(i=0;i<n;i++)
  {
    ll x;
    cin>>x;
    if(x!=0)
        arr.pb(x);
  }
  n=arr.size();
  ll memo[n][k+1],dp[n][k+1];
  if(arr.empty()==1)
  {
    if(k==0) 
     cout<<1;
    else
     cout<<0;
    return 0;
  }
  for(i=0;i<=k;i++)
  {
    if(i<=arr[0])
    {
      memo[0][i]=1;
      dp[0][i]=i+1;
    }
    else
    {
      memo[0][i]=0;
      dp[0][i]=dp[0][i-1];
    }
  }
  for(i=1;i<n;i++)
  {
     for(j=0;j<=k;j++)
     {
        if(j<=arr[i])
             memo[i][j]=dp[i-1][j]%bg;
        else
             memo[i][j]=(dp[i-1][j]%bg-dp[i-1][j-arr[i]-1]%bg+bg)%bg;
       if(j!=0)
       	dp[i][j]=(memo[i][j]%bg+dp[i][j-1]%bg)%bg;
       else
        dp[i][j]=1; 
     } 
  }
  cout<<memo[n-1][k];
  return 0;
}

Measured memory_bytes: 156544
import sys

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

if B<=C or D<=A:
    print(0)
    sys.exit()

if A<=C:
    if B < D:
        print(B-C)
    else:
        print(D-C)
else:
    if B < D:
        print(B-A)
    else:
        print(D-A)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
	    Scanner s = new Scanner(System.in);
	    int in = s.nextInt();
	    int out[] = new int[6];
	    for(int i=0 ; i<in ; i++){
		double a = s.nextDouble();
		if(a<165.0){
		    out[0]++;
		    continue;
		}if(a<170.0){
		    out[1]++;
		    continue;
		}if(a<175.0){
		    out[2]++;
		    continue;
		}if(a<180.0){
		    out[3]++;
		    continue;
		}if(a<185.0){
		    out[4]++;
		    continue;
		}else{
		    out[5]++;
		}
	    }
	    for(int i=0 ; i<6 ; i++){
		System.out.print(i+1 + ":");
		for(int j=0 ; j<out[i] ; j++)
		    System.out.print("*");
		System.out.println();
	    }

      	}
}

Measured memory_bytes: 0
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()

import bisect
ans=0
for i in b:
    q=bisect.bisect_left(a,i)
    s=bisect.bisect_right(c,i)
    ans=ans+q*(n-s)
print(ans)
    

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

using namespace std;
typedef long long lli;

int n,arr[200000];
int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",arr+i);

	int c[20]={0,},j=0;
	lli ans=0;
	for(int i=0;i<n;i++) {
		while(j<n) {
			int f=0;
			for(int k=0;k<20;k++) {
				if(c[k] + (arr[j]>>k & 1) == 2) {
					f=1;
					break;
				}
			}
			if(f) break;
			for(int k=0;k<20;k++) c[k] += arr[j]>>k & 1;
			j++;
		}
		ans += j-i;
		for(int k=0;k<20;k++) c[k] -= arr[i]>>k & 1;
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <limits>
#include <limits.h>

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

void toc(int i, char &a, char &b, char &c)
{
	c = '0' + i % 10;
	i /= 10;
	b = '0' + i % 10;
	i /= 10;
	a = '0' + i % 10;
}

bool isinclude(const string& S, char a, char b, char c)
{
	int status = 0;
	for (char i : S)
	{
		if (status == 0 && i == a) status++;
		else if (status == 1 && i == b) status++;
		else if (status == 2 && i == c) status++;
	}
	return status == 3;
}

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

	int ans = 0;
	for (int i = 0; i < 1000; i++)
	{
		char a, b, c;
		toc(i, a, b, c);
		if (isinclude(S, a, b, c))ans++;
	}

	std::cout << ans;
}

Measured memory_bytes: 256
class Circle
  def compare(list)
    xa, ya, ra, xb, yb, rb = list
    cd = center_distance(xa, ya, xb, yb)
    return 0  if cd > ra + rb
    return 2  if cd + rb < ra
    return -2 if cd + ra < rb
    1
  end

  def center_distance(xa, ya, xb, yb)
    ((ya - yb)**2 + (xa - xb)**2)**(1 / 2.0)
  end
end

n = STDIN.gets.chomp.to_i
inputs = STDIN.read.split("\n").map { |e| e.split.map { |e| e.chomp.to_f } }
n.times do |i|
  puts Circle.new.compare(inputs[i])
end

Measured memory_bytes: 8776
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"

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


class ASomethingOnIt {
public:
    void solve(std::istream &in, std::ostream &out) {
      string s;
      in >> s;
      int add = 0;
      REP(i, s.length()) if (s[i] == 'o') add++;
      out << add * 100 + 700 << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  ASomethingOnIt solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

using namespace std;

/* * * *   * * *   	* * * */
typedef long long ll;
const int oo = 1e9;
const ll mod = 100000000;
typedef complex<ll> P;
#define X real()
#define Y imag()
/* * * *   * * *   	* * * */

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m; cin>>n>>m;
	if (n >= m){cout<<0; return 0;}
	vector<int> a(m), b;
	for(int i=0; i<m; ++i)cin>>a[i];
	sort(a.begin(), a.end());
	for (int i=1; i<m; ++i) b.push_back(a[i] - a[i-1]);
	sort(b.begin(), b.end());
	int x = 0;
	for (int i=0; i<m-n; ++i) x+=b[i];
	cout<<x;
	return 0;
}


Measured memory_bytes: 1276
//b.c B-105
#include<stdio.h>

int main(void){
    int n,count=0,num=0;
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        for(int j=1;j<=i;++j){
            if(i%j==0&&i%2!=0){
                count++;
            }
        }
        if(count==8){
            num++;
        }
        count=0;
    }
    printf("%d\n",num);
    return 0;
}

Measured memory_bytes: 128
#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, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 A,B,Q;
    cin >> A >> B >> Q;

    vector<i64> s(A),t(B);
    rep(i,0,A){
        cin >> s[i];
    }
    rep(i,0,B){
        cin >> t[i];
    }

    auto cost=[](i64 x,i64 y,i64 z){
        return abs(x-y)+abs(y-z);
    };

    rep(i,0,Q){
        i64 xi;
        cin >> xi;

        i64 ans=inf64;

        if(s[0]<xi and t[0]<xi){
            i64 l1=*(--lower_bound(begin(s),end(s),xi));
            i64 l2=*(--lower_bound(begin(t),end(t),xi));
            ans=min(ans,cost(xi,l1,l2));
            ans=min(ans,cost(xi,l2,l1));
        }
        if(s[0]<xi and t.back()>=xi){
            i64 l1=*(--lower_bound(begin(s),end(s),xi));
            i64 r1=*(lower_bound(begin(t),end(t),xi));
            ans=min(ans,cost(xi,l1,r1));
            ans=min(ans,cost(xi,r1,l1));
        }
        if(s.back()>=xi and t[0]<xi){
            i64 r1=*(lower_bound(begin(s),end(s),xi));
            i64 l1=*(--lower_bound(begin(t),end(t),xi));
            ans=min(ans,cost(xi,r1,l1));
            ans=min(ans,cost(xi,l1,r1));
        }
        if(s.back()>=xi and t.back()>=xi){
            i64 r1=*(lower_bound(begin(s),end(s),xi));
            i64 r2=*(lower_bound(begin(t),end(t),xi));
            ans=min(ans,cost(xi,r1,r2));
            ans=min(ans,cost(xi,r2,r1));
        }

        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: 2944
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A,B;
  string N,M,P;
  cin>>N>>M>>A>>B>>P;
  if(N==P){
    cout<<A-1<<endl;
    cout<<B<<endl;
  }
  else if(M==P){
    cout<<A<<endl;
    cout<<B-1<<endl;
  }
  else{
    cout<<A<<endl;
    cout<<B<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,a,ans=INT_MAX;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a;
        int z = 0;
        while(a%2 == 0){
            a = a/2;
            z++;
        }
        
        ans = min(ans, z);        
                
    }
    
    cout<< ans <<endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

int main() {
        long long k, a, b;
        scanf("%lld%lld%lld", &k, &a, &b);
        long long d = a - b;
        if (d <= 0) {
                if (a >= k) {
                        puts("1");
                        return 0;
                } else {
                        puts("-1");
                        return 0;
                }
        } else {
                long long ans = (k - a + d - 1) / d;
                printf("%lld\n", ans * 2 + 1);
        }
        return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int A, B;

int main(void)
{
  scanf("%d %d", &A, &B);
  if (A <= 5) {
    printf("0\n");
  }
  else if (A >= 6 && A <= 12) {
    printf("%d\n", B / 2);
  }
  else {
    printf("%d\n", B);
  }
  return 0;
}


Measured memory_bytes: 888
/*



*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define MAXIN 300000
//#define gc() (SS==TT&&(TT=(SS=IN)+fread(IN,1,MAXIN,stdin),SS==TT)?EOF:*SS++)
typedef long long LL;
const int N=1e5+5;

int p[N];
LL f[N];
char IN[MAXIN],*SS=IN,*TT=IN;

inline int read()
{
	int now=0;register char c=gc();
	for(;!isdigit(c);c=gc());
	for(;isdigit(c);now=now*10+c-'0',c=gc());
	return now;
}

int main()
{
	int n=read(),E=read(),T=read();
	for(int i=1; i<=n; ++i) p[i]=read();
	LL mn=1e16;
	for(int i=1,j=0; i<=n; ++i)
	{
		while(T<=2*(p[i]-p[j+1])) mn=std::min(mn,f[j]-2*p[j+1]), ++j;
		if(j!=i) f[i]=std::min(f[j]+T,2*p[i]+mn);
		else f[i]=2*p[i]+mn;
	}
	printf("%lld\n",f[n]+E);

	return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
            double r = sc.nextDouble();

            double area = r*r*Math.PI;
            double cir = 2*r*Math.PI;

            System.out.printf("%.6f %.6f\n",area,cir);
		}
	}
}



Measured memory_bytes: 28328
import sys
input = sys.stdin.readline
def find(A,x):
    p = A[x]
    if p == x:
        return x
    a = find(A,p)
    A[x] = a
    return a
 
def union(A, x, y):
#    bx, by = sorted([find(A,x), find(A,y)]) # bx, by = find(A,x), find(A,y)だと無限ループ。
    if find(A,x) > find(A,y):
        bx, by = find(A,y), find(A,x)
    else:
        bx, by = find(A,x), find(A,y)
    A[y] = bx
    A[by] = bx

from collections import defaultdict
def main():
    N, M, K = map( int, input().split())
    AB = [ tuple( map( lambda x:x-1, map( int, input().split()))) for _ in range(M)]
    CD = [ tuple( map( lambda x:x-1, map( int, input().split()))) for _ in range(K)]
    fn = [0]*N
    bn = [0]*N
    df = defaultdict( lambda : False)
    friends = [ i for i in range(N)]
#    blocks = [ i for i in range(N)]
    for a, b in AB:
        fn[a] += 1
        fn[b] += 1
        df[(a,b)] = True
        df[(b,a)] = True
        union(friends,a,b)
    for c, d in CD:
#        union(blocks, c, d)
        if find(friends, c) == find( friends, d):
            if not df[(c,d)]:
                bn[c] += 1
                bn[d] += 1
    S = [-1]*N
    for i in range(N):
        S[ find( friends, i)] += 1
    ANS = [0]*N
    for i in range(N):
        ANS[i] = S[ find( friends, i)] - fn[i] - bn[i]
    print(' '.join( map( str, ANS)))
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 75684
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int fun(int x)
{
	if(x==1)
		return 1;
	return 2*fun(x/2)+1;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(10)<<fixed;
	
	int h,n;
	cin>>h>>n;
	int a[n+1],b[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i];
	int d[n+1][h+1];
	memset(d,0,sizeof(d));
	for(int i=0;i<=n;i++)
		for(int j=1;j<=h;j++)
			d[i][j]=INT_MAX;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=h;j++)
		{
			if(j<a[i])
				d[i][j]=min(b[i],d[i-1][j]);
			else
			{
				d[i][j]=min(d[i-1][j],b[i]+d[i-1][j-a[i]]);
				d[i][j]=min(d[i][j],d[i][j-a[i]]+b[i]);
			}
		}
	}
	//cout<<d[1][h]<<endl;
	cout<<d[n][h]<<endl;
	return 0;
}



Measured memory_bytes: 78592
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    a, b = list(map(int,ipti().split()))
    ans = a + b
    ans = max(ans,a-b)
    ans = max(ans,a*b)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060