akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (ll i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define debug(x) cerr << #x << ": " << (x) << endl
#define debug2(x, y) cerr << #x << ": " << (x) << " " << #y << ": " << y << endl;
#define int long long
using namespace std;
using II = pair<int, int>;
using VII = vector<II>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { int n = d.size(); REP (i, n) s << d[i] << " "; return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& dd) { for (vector<T> d: dd) s << d << endl; return s; }
template <class T, class S> ostream& operator<<(ostream &s, const pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
const int MOD = 1e9 + 7;

signed main() {
  int N; cin >> N;
  VI a(N);
  REP (i, N) cin >> a[i];
  int s = accumulate(ALL(a), 0ll);
  int ans = 0;
  REP (i, N) {
    if (abs(N * a[i] - s) < abs(N * a[ans] - s)) {
      ans = i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize
    }
    let ans = n / 11 * 2 + (n % 11 + 5) / 6;
    println!("{}", ans);
}


Measured memory_bytes: 4352
class Main {
    public static void main(String[] args) {
        java.util.Scanner stdInputScanner = new java.util.Scanner(System.in);

        String str = stdInputScanner.next();
        String output;

        if (str.matches(".*(.)\\1.*")) {
            output = "Bad";
        } else {
            output = "Good";
        }

        System.out.println(output);
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int t,n,k;
	cin>>t;
	ll a[t+2],b[t+2],c[t+2];
	for (int i = 0; i < t; ++i)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	for(int i=1;i<t;i++)
	{
		a[i]+=max(b[i-1],c[i-1]);
		b[i]+=max(a[i-1],c[i-1]);
		c[i]+=max(b[i-1],a[i-1]);
	}
	cout<<max(a[t-1],max(b[t-1],c[t-1]))<<endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
vector<string>v;
void dfs(string str,string t="",int cnt=0){
    if(cnt==2){
        v.push_back(t);
        return;
    }else{
        for(int i=0;i<str.size();i++){
            dfs(str,t+str[i],cnt+1);
        }
    }
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    while(cin>>n){
        if(n==1)cout<<"Hello World"<<endl;
        else{
            int a,b;
            cin>>a>>b;
            cout<<a+b<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;
const ll INF = 1LL << 60;

int main(){
  int n,k;
  set<int> s;
  cin >> n >> k;
  rep(i,k){
    int d;
    cin >> d;
    rep(i,d){
      int a;
      cin >> a;
      s.insert(a);
    }
  }
  cout << n-s.size() << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	for (int i=0;i<=(int)1e8;i++){
		if (a%2==1||b%2==1||c%2==1){
			cout<<i<<endl;
			return 0;
		}
		int na=b/2+c/2;
		int nb=a/2+c/2;
		int nc=a/2+b/2;
		a=na;
		b=nb;
		c=nc;
	}
	cout<<-1<<endl;
}

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

int ans=1e9;
string s;
set<char> has;

inline bool finish(string cur)
{
	for(int i=1;i<cur.size();i++) if(cur[i]!=cur[i-1]) return 0;
	return 1;
}

inline int solve(string cur,char fin)
{
	if(finish(cur)) return (s.size()-cur.size());
	for(int i=1;i<cur.size();i++) if(cur[i]==fin) cur[i-1]=fin;
	cur=cur.substr(0,cur.size()-1);
	return solve(cur,fin);
}

int main()
{
	cin>>s;
	
	for(int i=0;i<s.size();i++)
	{
		if(has.count(s[i])) continue;
		ans=min(ans,solve(s,s[i]));
		has.insert(s[i]);
	}
	
	cout<<ans;
	
	return 0;
}

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

int N, K;
char D[10];

bool dislike(int x_int) {
    string x = to_string(x_int);

    bool ret = false;
    for (int i = 0; i < x.length(); i++) {
        for (int j = 0; j < K; j++) {
            if (x[i] == D[j]) {
                ret = true;
                break;
            }
        }

        if (ret) break;
    }

    return ret;
}

int main() {
    cin >> N >> K;
    for (int i = 0; i < K; i++) cin >> D[i];

    int ans = N;
    while (dislike(ans)) {
        ans++;
    }
    
    cout << ans << endl;

    return 0;
}


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

using namespace std;

string str[10];

int main(){
	int n;

	str[2] = str[4] = str[5] = str[7] = str[9] = "hon";
	str[0] = str[1] = str[6] = str[8] = "pon";
	str[3] = "bon";

	cin >> n;

	cout << str[n % 10] << endl;

	return 0;
}

Measured memory_bytes: 3624
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [n, t] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const [, ...ct] = stdin
  .trim()
  .split('\n')
  .map(e => e.split(' ').map(Number))

const filtered = ct.filter(e => e[1] <= t)

const ans = _ => {
  if(filtered.length <= 0){
    return 'TLE'
  }

  return Math.min(...filtered.map(e=>e[0]))
}

console.log(ans())


Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pll = pair < ll, ll >;
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
#define pb push_back
#define mp make_pair
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e7 + 10;

ll divisors[N];

void find() {
    for(ll i = 1; i < N; i++) {
        for(ll j = i; j < N; j += i) {
            divisors[j]++;
        }
    }
    return;
}

int main(){   
    find();
    ll n; cin >> n;
    ll ans = 0;
    for(ll i = 1; i <= n; i++) {
        ans += i * divisors[i];
    }
    cout << ans << endl;
}
    

Measured memory_bytes: 81740
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <random>

using namespace std;

void pass(){
	return;
}

#define prev _prev
#define hash _hash;
#define rand() rand()<<15+rand()
typedef long long ll;
typedef unsigned long long ull;

mt19937 rnd(rand());
const int MOD = 1e9 + 7;
const ll BIG_MOD = 1e18 + 7;
const int MAXN = 1e5 + 7;

int a[MAXN];

signed main(){
	cout.tie(NULL);
	cout.precision(20);
	//freopen("input.txt", "r", stdin);
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> a[i];
	}

	int ans = 0;
	for (int i = 0; i < n - 1; ++i){
		if (a[i] == i + 1){
			swap(a[i], a[i + 1]);
			++ans;
		}
	}

	if (a[n - 1] == n) ++ans;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 640
R, G, B, N = map(int,input().split())

ans = 0
for i in range(N+1):
    for j in range(N+1):
        if (R * i + G * j) > N:
            break
        if (N - R * i - G * j) % B == 0:
            ans += 1
print(ans)

Measured memory_bytes: 40428
k, n = map(int, input().split())
A = list(map(int, input().split()))
ans = []
for i in range(n):
    if i == 0:
        d = A[i] + (k - A[-1])
    else:
        d = A[i] - A[i-1]
    ans.append(d)
print(sum(ans) - max(ans))

Measured memory_bytes: 26420
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <algorithm>

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> cnt(N + 1, 0);
  for (int i = 0; i < N; ++i) {
    int a;
    std::cin >> a;
    ++cnt[a];
  }
  std::sort(cnt.rbegin(), cnt.rend());
  int ans = 0;
  for (int i = 0; i < K; ++i) {
    ans += cnt[i];
  }
  std::cout << N - ans << std::endl;
  return 0;
}

Measured memory_bytes: 1152
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

const int MAX_N = 200005;
typedef long long ll;
#define sq(a) ((a)*1LL*(a))
#define sz(a) ((a).size())

int n,h[MAX_N],ptr;
ll c,dp[MAX_N];
vector<ll> k,d;

bool bad(int a, int b, int c)
{
	return (d[c]-d[a])*(k[a]-k[b])<=(d[b]-d[a])*(k[a]-k[c]);
}

void add(ll K, ll D)
{
	k.push_back(K);
	d.push_back(D);
	while (sz(k)>=3&&bad(sz(k)-3,sz(k)-2,sz(k)-1))
	{
		k.erase(k.end()-2);
		d.erase(d.end()-2);
	}
}

ll query(int x)
{
	ptr=min(int(k.size())-1,ptr);
	while (ptr+1<k.size()&&k[ptr]*x+d[ptr]>k[ptr+1]*x+d[ptr+1])
		ptr++;
	return k[ptr]*x+d[ptr];
}

int main()
{
	scanf("%d %lld",&n,&c);
	for (int i=1; i<=n; i++)
		scanf("%d",h+i);
	add(-2*h[1],sq(h[1]));
	for (int i=2; i<=n; i++)
	{
		dp[i]=query(h[i])+sq(h[i])+c;
		add(-2*h[i],dp[i]+sq(h[i]));
	}
	printf("%lld\n",dp[n]);
	return 0;
}


Measured memory_bytes: 5868
N,K=[int(i) for i in input().split()]
R={}
for n in range(N):
    a,b=[int(i) for i in input().split()]
    R[a]=b+(R[a] if (a in R) else 0)
RR=sorted(list(R.keys()))
k=0
for ir in range(len(RR)):
    k+=R[RR[ir]]
    if k>=K:
      print(RR[ir])
      break
  
  


Measured memory_bytes: 16508
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 505

int N;
ull POW[64];
ull S[2][SIZE],U[2][SIZE];
ull ans[SIZE][SIZE],BIT[2][SIZE],work[SIZE][SIZE];

void transPose(){

	for(int row = 0; row < N; row++){
		for(int col = 0; col < row; col++){

			swap(work[row][col],work[col][row]);
		}
	}
}

bool solve(){

	for(int row = 0; row < N; row++){
		for(int col = 0; col < N; col++){

			work[row][col] = -1;
		}
	}

	for(int loop = 0; loop < 2; loop++){
		for(int row = 0; row < N; row++){

			ull tmp = BIT[loop][row];
			if(S[loop][row] != tmp){ //論理積が1,または論理和が0

				for(int col = 0; col < N; col++){

					if(work[row][col] == (1-tmp)){

						return false;
					}
					work[row][col] = tmp;
				}
			}
		}
		transPose();
	}

	for(int a = 0; a < 2; a++){
		for(int loop = 0; loop < 2; loop++){
			for(int row = 0; row < N; row++){
				ull tmp = BIT[loop][row];
				if(S[loop][row] == tmp){ //論理積の0,論理和の1:少なくとも1つ行の中にあれば良い
					vector<int> p;
					bool FLG = false;
					for(int col = 0; col < N; col++){
						if(work[row][col] == -1){ //未確定列

							p.push_back(col);
						}
						if(work[row][col] == tmp){

							FLG = true;
						}
					}
					if(FLG)continue; //条件を既に満たしている
					if(p.size() == 0)return false;
					if(p.size() == 1){

						work[row][p[0]] = tmp;
					}
					//p.size() >= 2:保留
				}
			}
			transPose();
		}
	}

	vector<int> R,C;

	for(int row = 0; row < N; row++){
		for(int col = 0; col < N; col++){
			if(work[row][col] == -1){
				R.push_back(row);
				break;
			}
		}
	}
	for(int col = 0; col < N; col++){
		for(int row = 0; row < N; row++){
			if(work[row][col] == -1){

				C.push_back(col);
				break;
			}
		}
	}

	for(int i = 0; i < R.size(); i++){
		for(int k = 0; k < C.size(); k++){

			work[R[i]][C[k]] = (i+k)%2;
		}
	}

	return true;
}


int main(){

	POW[0] = 1;
	for(int i = 1; i <= 63; i++){

		POW[i] = POW[i-1]*2;
	}

	scanf("%d",&N);

	for(int i = 0; i < N; i++){

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

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

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

		cin >> U[1][i];
	}

	for(int row = 0; row < N; row++){
		for(int col = 0; col < N; col++){

			ans[row][col] = 0;
		}
	}

	for(int i = 63; i >= 0; i--){ //桁のループ
		for(int loop = 0; loop < 2; loop++){ //行、列のループ
			for(int k = 0; k < N; k++){ //行または列のループ
				if(U[loop][k] & POW[i]){

					BIT[loop][k] = 1;

				}else{

					BIT[loop][k] = 0;
				}
			}
		}
		if(!solve()){

			printf("-1\n");
			return 0;
		}
		for(int row = 0; row < N; row++){
			for(int col = 0; col < N; col++){

				ans[row][col] += POW[i]*work[row][col];
			}
		}
	}

	for(int row = 0; row < N; row++){

		printf("%llu",ans[row][0]);
		for(int col = 1; col < N; col++){

			printf(" %llu",ans[row][col]);
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 9448
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005

void solve(){
    int n;
    cin >> n;
    int i,a[n+1],j,k;
    int s=0;
    for(i=1; i<=n; i++){
        cin >> a[i];
        s=s^a[i];
    }
    for(i=1; i<=n; i++){
        int r=s^a[i];
        cout << r << ' ';
    }

}




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

        int tt;
        tt=1;
    //    cin >> tt;
     while(tt--){
            solve();
        }
        

}

Measured memory_bytes: 5116
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ls rt << 1
#define rs rt << 1 | 1
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
const int P = 1e9 +7;
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int N = 1000010;
map<int, int> a;
int main()
{
	int n = read();
	rep(i, 1, n)
	{
		int x = read();
		a[x] ++;
	}
	int m = read();
	while(m --)
	{
		int x = read();
		if(!a[x]) {puts("NO"); return 0;}
		a[x] --;
	}
	puts("YES");
	return 0;
}


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

#define sf scanf
#define pf printf
#define endl "\n"
#define off ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fr freopen("in.txt", "r", stdin)
#define fw freopen("out.txt", "w", stdout)
#define pb push_back
#define eb emplace_back
#define PII pair<int, int>
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl
#define pass printf("Passed Here\n")

typedef long long ll;
typedef unsigned int ui;
int mod = 1000000007;

int main()
{
    int n;
    cin>>n;
    ll ara[n+2];
    int ans = 0;
    for(int i = 0; i< n; i++) {
        cin>>ara[i];
        while(ara[i]%2 == 0) {
            ans++;
            ara[i] /= 2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
from math import atan, pi

a, b, x = map(int, input().split())

h = x / (a**2)


border = a**2 * b / 2

if x < border:
    theta = atan(a * (b**2) / 2 / x) * 180 / pi
else:
    theta = atan(2 / a * (b - h)) * 180 / pi

print('{:.10f}'.format(theta))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    set<string> s;
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        s.insert(S);
    }
    cout << s.size() << "\n";
    return 0;
}


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

int main() {
    int N, M; cin >> N >> M;
    long long ac = 0;
    long long pena = 0;
        
    vector<long long> wa(N, 0), isac(N, 0);
    for (int i = 0; i < M; ++i) {
        int p; string s;
        cin >> p >> s;
        --p;
        if (s == "AC") {
            if (!isac[p]) {
                ++ac;
                pena += wa[p];
                isac[p] = true;
            }
        }
        else wa[p]++;
    }
    cout << ac << " " << pena << endl;
}

Measured memory_bytes: 1792
n = int(input())
s = input()

R = s.count("R")
G = s.count("G")
B = s.count("B")

c1 = R*G*B

c1_2bar = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        k = 2*j - i
        if k > j and k <= n-1:
            if all([
                s[i] != s[j],
                s[j] != s[k],
                s[k] != s[i]]):
                c1_2bar += 1

print(c1 - c1_2bar)

Measured memory_bytes: 68448
n = int(input())
R = []

for i in range(n):
    r = int(input())
    R.append(r)

maxv = R[1] - R[0]
minv = R[0]

for r in R[1:]:
    maxv = max(maxv, r - minv)
    minv = min(minv, r)

print(maxv)


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

static class CodeJam
{
    static long Solve(long A, long B)
    {
        long X = (A + 3) & ~3L;
        long Y = (B + 0) & ~3L;

        long xor = 0;
        if (X <= Y)
        {
            for (long i = A; i < X; ++i) { xor ^= i; }
            for (long i = Y; i <= B; ++i) { xor ^= i; }
        }
        else
        {
            for (long i = A; i <= B; ++i) { xor ^= i; }
        }
        return xor;
    }

    static void Main(string[] args)
    {
        long[] V = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        Console.WriteLine(Solve(V[0], V[1]));
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPEQ(i, n) FOREQ(i, 0, n)
#define ALL(c) (c).begin(), (c).end()

template <typename T> inline int size(const T& x) { return x.size(); }

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

    int m, n_min, n_max;
    while (cin >> m >> n_min >> n_max, m | n_min | n_max) {

        vector<int> P(m);
        REP(i, m) cin >> P[i];

        int max_gap = 0, ans = -1;
        FOR(i, n_min-1, n_max) {
            int gap = P[i] - P[i+1];
            if (gap >= max_gap) {
                max_gap = gap;
                ans = i+1;
            }
        }

        cout << ans << endl;
    }
}

Measured memory_bytes: 3104
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int64_t gcd(int64_t a, int64_t b)
{
    if (a < b)
    {
        return gcd(b, a);
    }
    else if (a % b == 0)
    {
        return b;
    }
    else
    {
        return gcd(b, a % b);
    }
}

int main()
{
    int64_t a, b;
    cin >> a >> b;
    cout << (a * b / gcd(a, b)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
bool prime(const int n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n%2 == 0) return false;
    if(n%3 == 0) return false;
    // 2と3の倍数でないので6の倍数ではないことが保証された

    if(n%6 != 1 && n%6 != 5) return false;
    // 6の倍数前後の数(素数かもしれない数)であることが保証された

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i=5;i*i<=n;i+=6){
        if(n%i     == 0) return false; // 6n-1
        if(n%(i+2) == 0) return false; // 6n+1
    }

    return true;
}
int main()
{
  int a;
  cin >> a;
  int i = a;
  while(true){
    if(prime(i)){
      break;
    }else{
      i++;
    }
  }
  cout << i << endl;
}


Measured memory_bytes: 256
import itertools
n,k = map(int,input().split())
p = list(map(int,input().split()))
acc =[0]+ list(itertools.accumulate([x for x in p]))
 
 
ans=max(acc[i]-acc[i-k] for i in range(k,n+1))
answer=ans/2+k/2
print(answer)

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a){cout<<((a)?"Yes":"No")<<endl;}
void YESNO(int a){cout<<((a)?"YES":"NO")<<endl;}
void AorB(int a,string b,string c){cout<<((a)?b:c)<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,m;
    cin>>n>>m;
    Vi p(m);
    VVi s(n);
    REP(i,0,m){
        int t;
        cin>>t;
        REP(j,0,t){
            int t1;
            cin>>t1;
            t1--;
            s[t1].pb(i);
        }
    }
    REP(i,0,m) cin>>p[i];
//    REP(i,0,n){
//        cout<<"switch"<<i<<" ";
//        REP(j,0,s[i].size()){
//            cout<<s[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    
    int ans=0;
    int k=1;
    k<<=n;
    REP(i,0,k){
        Vi light(m,0);
        for(int mask=1; mask<k; mask<<=1){
            if(i&mask){
                int l=log2(mask);
                REP(j,0,s[l].size()) light[s[l][j]]++;
            }
        }
        int check=0;
        REP(j,0,m) if(light[j]%2==p[j]) check++;
        if(check==m){ans++;}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()

r_cnt, l_cnt = 0, 0
for i in range(n):
    if s[i] == "(":
        r_cnt += 1
    else:
        if r_cnt == 0:
            l_cnt += 1
        else:
            r_cnt -= 1

print(l_cnt * "(" + s + r_cnt * ")")

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<string> fs(n);
	ll ans = 0;
	rep(i, n) {
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		fs.at(i) = s;
	}
	sort(fs.begin(), fs.end());
	int count = 1;
	string now = fs[0];
	rep2(i, 1, n) {

		if (fs[i] != now) {
			count = 1;
			now = fs[i];
		}
		else ++count;
		ans += count - 1;
	}
	cout << ans << endl;
}

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


int32_t main() {
	int n;
	cin >> n;
	if(n==22) cout << "Christmas Eve Eve Eve";
	if(n==23) cout << "Christmas Eve Eve";
	if(n==24) cout << "Christmas Eve";
	if(n==25) cout << "Christmas";
	return 0;
}



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

using namespace std;

int main(){
    string N;
    cin >> N;
    int sz = N.size();
    for(int i=0;i<N.size();i++){
        if(i!=0 && N[i]!='9'){
            cout << N[0]-'0' + 9*(sz-1) - 1 << endl;
            return 0; 
        }
    }

    cout << N[0]-'0' + 9*(sz-1) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define Size 8

int M[Size][Size]={};
int G[Size]={};
int C;
int F=0;

void printQ(){
  int i,j;
  for(i=0;i<Size;i++){
    for(j=0;j<Size;j++){
      if(M[i][j]==1)printf("Q");
      else printf(".");
    }
    printf("\n");
  }
  F=1;
  //printf("1\n");
}


void put(int u,int v,int c){
  int i,j;

  //printf("%d\n",C);
  
  M[u][v]+=c;
  C+=c;
  for(i=u-1;i>=0;i--)M[i][v]+=c;
  for(j=v-1;j>=0;j--)M[u][j]+=c;
  for(i=u+1;i<Size;i++)M[i][v]+=c;
  for(j=v+1;j<Size;j++)M[u][j]+=c;
  for(i=u-1,j=v-1;i>=0 && j>=0;i--,j--)M[i][j]+=c;
  for(i=u+1,j=v-1;i<Size && j>=0;i++,j--)M[i][j]+=c;
  for(i=u-1,j=v+1;i>=0 && j<Size;i--,j++)M[i][j]+=c;
  for(i=u+1,j=v+1;i<Size && j<Size;i++,j++)M[i][j]+=c;
  G[u]+=c;
}

void set(int u){
  int i,j;
  if(F==1)return;
  //printf("%d\n",C);
  if(C==Size){printQ();return;}
  
  for(i=u;i<Size;i++){
      if(G[i]==0)for(j=0;j<Size;j++)if(M[i][j]==0){
	    put(i,j,1);
	    set(u+1);
	    put(i,j,-1);
	  }
    }
}

int main(){
  int a,b,c,i,j,k;
  scanf("%d",&a);
  C=a;
  for(i=0;i<a;i++){
    scanf("%d %d",&b,&c);
    M[b][c]++;
    for(j=b-1;j>=0;j--)M[j][c]++;
    for(k=c-1;k>=0;k--)M[b][k]++;
    for(j=b+1;j<Size;j++)M[j][c]++;
    for(k=c+1;k<Size;k++)M[b][k]++;
    for(j=b-1,k=c-1;j>=0 && k>=0;j--,k--)M[j][k]++;
    for(j=b+1,k=c-1;j<Size && k>=0;j++,k--)M[j][k]++;
    for(j=b-1,k=c+1;j>=0 && k<Size;j--,k++)M[j][k]++;
    for(j=b+1,k=c+1;j<Size && k<Size;j++,k++)M[j][k]++;
    G[b]+=c;
  }
  //printf("can\n");
  //printQ();
  set(0);
  //put(0,1,1);
    
  //for(i=0;i<Size;i++){for(j=0;j<Size;j++)printf("%d",M[i][j]);printf("\n");}
}


Measured memory_bytes: 2108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <climits>
using namespace std;

bool comp(pair<int, string> a, pair<int, string> b){
  if(a.first != b.first) return a.first > b.first;
  else return a.second < b.second;
}
 
int main(){
  int a,b,h;
  cin >> a >> b >> h;

  cout << (a + b)*h/2.0 << endl;
}

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

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

  vector<tuple<string, int, int>> v(n);
  for(int i = 0; i < n; i++){
    cin >> get<0>(v[i]) >> get<1>(v[i]);
    get<1>(v[i]) = 100 - get<1>(v[i]);
    get<2>(v[i]) = i + 1;
  }

  sort(v.begin(), v.end());
  for(int i = 0; i < n; i++){
    cout << get<2>(v[i]) << endl;
  }
}

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

using namespace std ;

int Function1(int a,int N){
    if(!(N%a)){
        return 1;
    }
    else{
        return 0;
    }
}

int Function2(int b1,int b2,int N){
    int temp;
    if(b1<b2){
        temp=b1;
        b1=b2;
        b2=temp;
    }
    int n=N/b1;
    int sum=0;
    for(int i=0;i<n+1;i++){
        sum+=Function1(b2,N-b1*i);
    }
    return sum;
}

int Function3(int c1,int c2,int c3,int N){
    int temp;
    if(c1<c2){
        temp=c1;
        c1=c2;
        c2=temp;
    }
    if(c1<c3){
        temp=c1;
        c1=c3;
        c3=temp;
    }
    int n=N/c1;
    int sum=0;
    for(int i=0;i<n+1;i++){
        sum+=Function2(c2,c3,N-c1*i);
    }
    return sum;

}

int main(){
    int R,G,B,N;
    scanf("%d %d %d %d",&R,&G,&B,&N);
    printf ("%d",Function3(R,G,B,N));
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        for (int i = 0; i < n; i++) a[i] = a[i] - (i + 1);
        a = a.OrderBy(x => x).ToArray();
        long ans = 0;
        long b = a[a.Count() / 2];
        for (int i = 0; i < n; i++)
        {
            ans += Math.Abs(a[i] - b);
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 32528
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b; cin >> a >> b;
  if(a+b==15) puts("+");
  else if(a*b==15) puts("*");
  else puts("x");

  return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
import math

def main():
    N,_ = map(int, input().split())
    X = list(map(int, input().split()))
    X.sort()
    D = []
    for i in range(len(X)-1):
        D.append(X[i+1] - X[i])
    D.sort(reverse=True)
    D = D[N-1:]
    n = 0
    for d in D:
        n += d
    print(n)

if __name__ == '__main__':
    main()

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

#define rep0(i, n) for(int i=0; i<(int)(n);i++)
#define rep1(i, n) for(int i=1; i<=(int)(n);i++)
#define all(x) (x).begin(), (x).end()

using namespace std;

#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}
template<typename T> ostream& operator << (ostream& s, const vector<T>& v);
bool flagdebug = false;


typedef int64_t lint;

int main(){
    //flagdebug = true; ///本番時削除！！！！！

    lint n, k;
    cin >> n >> k;
    vector<lint> v(n + 1); //1~n
    rep1(i,n)
    {
        cin >> v[i];
    }

    lint lp = 0; //左から取ったときの価値プラスの合計
    vector<lint> lgabage; //左から取った時に発生するゴミ
    lint ans = 0; //解答

    //左から取る回数で全探索
    for(lint l = 0 ; l <= min(k,n) ; l ++)
    {
        if(l > 0)
        {
            if(v[l]>=0)//価値0以上のみlpに加算
            {
                lp+=v[l];
            }
            else //それ以下はゴミとして保存
            {
                lgabage.push_back(v[l]);
            }
        }

        lint rp = 0;
        vector<lint> gabage;//右から取った時に発生するゴミ（左からの分もコピーしておく）
        copy(all(lgabage), back_inserter(gabage));
        //右から取る回数の全探索
        for ( lint r = 0 ; r <= min(k,n) ; r ++)
        {
            if(l + r > n)break; //筒が空なら
            if(l + r > k)break; //行動回数制限を超えていたら

            if(r > 0)
            {
                if(v[n+1-r]>=0) //価値0以上のみrpに加算
                {
                    rp+=v[n+1-r];
                }
                else //それ以下はゴミとして保存
                {
                    gabage.push_back(v[n+1-r]);
                }
            }

            lint val = lp + rp; //価値（マイナスは含まない）

            //余った行動回数(k - l - r)でマイナスを捨てることを考える
            if(k - l - r < gabage.size())
            {
                //行動回数が足りないのでマイナスを一部加算する
                //昇順に並べ替えるとマイナスの絶対値が大きいものが前にくる
                //前の方は捨てるので後ろの方のみ結果に加算する
                sort(all(gabage));
                for(lint i = k - l - r; i < gabage.size() ; i++)
                {
                    val += gabage[i];
                }
            }
            //else//行動回数があるのでマイナスは全て捨てる（ので，余計な作業はいらない）


            ans = max(val,ans);
        }
    }

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

//vectorprint用
template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
    s << "[\t";
    for (auto i = v.begin(); i < v.end() - 1; i++){s << *i << "\t";}
    s << *(v.end() - 1) << "\t]\n";
	return s;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long T = sc.nextLong();
    long ans = T;
    long last = T;
    for(int i = 0; i < N; i++) {
      long t = sc.nextLong();
      if(i > 0) {
        if(last > t) {
          ans += (T - last + t);
          last += (T - last + t);
        } else {
          ans += T;
          last = t + T;
        }
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 60608
#include <iostream>

using namespace std;

int main(){

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

    if(a > b)
        swap(a, b);

    if(c >= a && c <= b){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

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

typedef long long ll;

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);

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 GetDigit(ll num) {return log10(num)+1;}

int main(){
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    cout << 'x';
  }
  cout << endl;
  return 0;
}


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

long long divisor(long long n) {
  long long ret = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    int cnt = 0;
    while (n % i == 0) {
      cnt++;
      n /= i;
    }
    ret *= (cnt + 1);
    if (n == 1) break;
  }
  if (n != 1) ret *= 2;
  return ret;
}

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

  long long ans = 0;
  for ( int c = 1; c < n; c++ ) {
    ans += divisor(n-c);
  }

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


Measured memory_bytes: 3672
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    double N; cin>>N;
    cout<<2.0*3.1415926535*N<<endl;
    
}




Measured memory_bytes: 3752
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

N = input()
A = [-INF] + sorted(map(int, raw_input().split())) + [INF]
B = sorted(map(int, raw_input().split()))
C = [-INF] + sorted(map(int, raw_input().split())) + [INF]

ans = 0

pos1 = 0
pos2 = 0

for num in B:
    while A[pos1] < num:
        pos1 += 1
    pos1 -= 1
    while C[pos2] <= num:
        pos2 += 1
    pos2 -= 1
    ans += pos1 * (N - pos2)

print ans

Measured memory_bytes: 18092
li = [int(input()) for i in range(6)]
k = li[5]
cnt = 0
if li[4] - li[0] > k: 
    cnt+=1
if li[3] - li[0] > k:
    cnt+=1
if li[2] - li[0] > k:
    cnt +=1
if li[1] - li[0] > k:
    cnt+=1
if li[4] - li[1] > k:
    cnt+=1
if li[3] - li[1] > k:
    cnt+=1
if li[2] - li[1] > k:
    cnt+=1
if li[4] - li[2] > k:
    cnt+=1
if li[3] - li[2] > k:
    cnt+=1
if li[4] - li[3] > k:
    cnt +=1
print(':(') if cnt>0 else print('Yay!')

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
using namespace std;

int B[100000];

int main(){
  int N = 3;
  cin >> N;
  int max = N-1;
  int ans = 0;
  for(int t=0;t<max;t++)
  {
    cin >> B[t];
  }
  
  ans += B[0];
  
  for(int t=1; t<max; t++)
  {
    ans += min(B[t], B[t-1]);
  }
  
  ans += B[max-1];
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

    int num;
    cin>>num;

    cout<<ceil(double(num)/1000.0)*1000-num<<"\n";


    return 0;
}


Measured memory_bytes: 3796
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e3 + 10;
LL a[N];
LL b[N];
LL c[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	typedef tuple<LL, int, int, int> Node;
	priority_queue<Node> pq;
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	for (int i = 1; i <= x; i++) cin >> a[i];
	for (int i = 1; i <= y; i++) cin >> b[i];
	for (int i = 1; i <= z; i++) cin >> c[i];
	sort(a + 1, a + x + 1);
	sort(b + 1, b + y + 1);
	sort(c + 1, c + z + 1);
	reverse(a + 1, a + x + 1);
	reverse(b + 1, b + y + 1);
	reverse(c + 1, c + z + 1);
	for (int i = 1; i <= x; i++)
	{
		for (int j = 1; j <= y; j++)
		{
			pq.emplace(a[i] + b[j] + c[1], i, j, 1);
		}
	}
	while (k--)
	{
		LL ans;
		int o1, o2, o3;
		tie(ans, o1, o2, o3) = pq.top();
		printf("%lld\n", ans);
		pq.pop();
		if (o3 == z) continue;
		pq.emplace(a[o1] + b[o2] + c[o3 + 1], o1, o2, o3 + 1);
	}
	return 0;
}

Measured memory_bytes: 26984
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int N;
int a[100];
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin >> a[i];

    sort(a, a+N);
    cout << a[N-1]-a[0] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
using namespace std;

int main()
{
    cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
        if(s[i] == '7')
        {
            cout << "Yes";
            return 0;
        }
    cout << "No";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
//freopen("","r",stdin);
//freopen("","w",stdout);
int main(){
    ll a,b;
    cin >> a >> b;
    cout << (a * 500 >= b? "Yes":"No" ) << '\n';
    return 0;

}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define nl '\n'
#define sp ' '
#define zero '0'
#define r(a,b,c) for(ll a=(b);a<(c);++a)
#define v(a,b,c) for(ll a=(b);a>(c);--a)
#define f(a) cout<<fixed<<setprecision(10)<<a
#define d(a,b,c) cout<<setfill(a)<<setw(b)<<right<<c
#define hasten cin.tie(0);ios::sync_with_stdio(false)
ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y,z;

const int prime[15]=
{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};

inline void in(){}
template<class T,class...A>
inline void in(T&&t,A&&...a){cin>>t;in(move(a)...);}

template <class T>inline void out(T t){cout<<t<<nl;}
template <class T, class...A>
inline void out(T t,A...a){cout<<t<<' ';out(move(a)...);}

inline ll dig(ll a){ll d=1;while(a/=10)++d;return d;}

inline ll gcd(ll a,ll b)
{ll c;while(a){c=a;a=b%a;b=c;}return b;}

inline bool isp(ll a){
	if(a<48){r(i,0,15)if(prime[i]==a)return 1;}
	else if(a<2809)return gcd(614889782588491410,a)==1;
	else {out("Error:Argument is Over-2808!");exit(1);}
	return 0;
}

int main(){
	hasten;
	char kk;
	in(a,kk,a,kk,a);
  cout<<"2018/01/";
  d(zero,2,to_string(a));
	
}

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

int main() {
    string s;
    int cnt = 0;
    cin >> s;
    if(s[0] == '1') cnt++;
    if(s[1] == '1') cnt++;
    if(s[2] == '1') cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        
        long A = scanner.nextLong();
        long B = scanner.nextLong();
        long C = scanner.nextLong();
        long X = scanner.nextLong();
        long Y = scanner.nextLong();
        long price = 0;
        long price1 = 0;
        long price2 = 0;
        if(X<=Y){
            price1 = 2*C*X + B*(Y-X);
            price2 = 2*C*Y;
            price = Math.min(price1,price2);
        }else{
            price1 = 2*C*Y + A*(X-Y);
            price2 = 2*C*X;
            price = Math.min(price1,price2);
        }
        
        if(A*X+B*Y>=price){
            System.out.println(price);
        }else{
            System.out.println(A*X+B*Y);
        }
        
    }
}


Measured memory_bytes: 35672
import heapq

#N is numbers of BAITO, M is limit of days
N,M=map(int,input().split())
 
i=0
inp ={}
while i<N:
  readTime,inCome=map(int,input().split())
  if readTime in inp:
    inp[readTime].append(-inCome)
  else:
    inp[readTime]=[-inCome]
  
  i=i+1
 
#print(inp)  
 
result=0
pool=[]
heapq.heapify(pool)
i=1
while i<=M:
  if i in inp:
    for k in inp[i]:
      heapq.heappush(pool,k)
  if len(pool)>0:
    result=result-heapq.heappop(pool)
  i=i+1
 
print(result)

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

int main(void){
    int N, K;
    cin >> N >> K;
    int a[N+1];
    int num[N];
    int check=1;
    int count = 0;
    int ans=0;
    for(int i = 0; i < N; i++)
        cin >> a[i];
    a[N]=0;
    sort(a, a+N);
    for(int i = 1; i <=N; i++){
        if(a[i]==a[i-1])
            check++;
        else if(a[i]!=a[i-1]){
            num[count]=check; count++; check=1;}
    }
    sort(num, num+count);
    if(count<=K)
        ans=0;
    else if(count>K){
        for(int i = 0; i < (count-K); i++)
            ans+=num[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
n = gets.to_i
i = 0
while ((i += 1) <= n) do
  x = i
  while (x / 10 != 0) do
    x /= 10 if (x % 10 != 3)
    break if (x % 10 == 3)
  end
  print (i % 3 == 0) ? " #{i}" : ((x % 10 == 3) ? " #{i}" : "")
  puts "" if (i == n)
end

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

const int MAXN = 2003;

int n;
int a[MAXN];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	int res = 0;
	for (int mx = 0; mx < n; mx++) {
		int L = 0, R = mx - 1;
		while (L < R) {
			if (a[mx] < a[L] + a[R]) {
				res += R - L;
				R--;
			} else {
				L++;
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdlib.h>
#include <dirent.h>
using namespace std;
#define sp << " " << 
typedef vector<int> vi;
typedef vector<long int> vli;
typedef vector<long long int> vlli;
typedef long int li;
typedef long long int lli;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<lli,lli> > vplli;
typedef unordered_map<int,int> ump;

int main(){
    int n,w;
    cin >> n >> w;
    vector<pair<long long int,int>> arr;
    // vector<int> value;

    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        arr.push_back({b,a});
    }
    // sort(arr.begin(), arr.end());
    vector<vector<long long int>> dp(w+1,vector<long long int>(n,-1));

    for(int i=0;i<n;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<w+1;i++){
        if(arr[0].second<=i){
            dp[i][0]=arr[0].first;
        }
        else{
            dp[i][0] =0;
        }
    }
    // for(int i=0;i<w+1;i++){
    //     for(int j=0;j<n;j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    for(int i=1;i<n;i++){
        for(int j=1;j<w+1;j++){
            if(arr[i].second<=j){
                // cout << "Entering" << i sp j << endl;
                // cout << dp[j][i-1] sp arr[i].first+dp[j-arr[i].second][i-1] << endl;
                dp[j][i] = max(dp[j][i-1], arr[i].first+dp[j-arr[i].second][i-1]);
            }
            else{
                dp[j][i] = dp[j][i-1];
            }
            
        }
    }
    // for(int i=0;i<w+1;i++){
    //     for(int j=0;j<n;j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    cout << dp[w][n-1];

    return 0;
}

Measured memory_bytes: 83072
#include <bits/stdc++.h>
using namespace std;
int n,W;
int v[100];
int w[100];
int dp[101][10001];
int rec_dp(int i,int j){
  if(dp[i][j]!=-1){
    return dp[i][j];
  }
  int res;
  if(i==n){
    res=0;
  }
  else if(j<w[i]){
    res=rec_dp(i+1,j);
  }else{
    res=max(rec_dp(i+1,j),rec_dp(i+1,j-w[i])+v[i]);
  }
  dp[i][j]=res;
  return res;
}
int main(){
  cin>>n>>W;
  for(int i=0;i<n;i++){
    cin >>v[i]>>w[i];
  }
  for(int i=0;i<=n;i++){
    for(int j=0;j<=W;j++){
      dp[i][j]= -1;
    }
  }
  cout <<rec_dp(0,W)<<endl;
  return 0;
}

Measured memory_bytes: 6984