akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
const int mod = 1e9+7;

void solve()
{
    int k;
    cin >> k;
    ll val = 7%k;
    for(int i = 0; i <= 1e7; i++)
    {
        if(val == 0)
        {
            cout << i + 1 << endl;
            return;
        }
        val = (val*10 + 7)%k;
    }
    cout << -1 << endl;
}


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


Measured memory_bytes: 3616
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

lint f(lint n, lint x)
{
    return n == -1 ? 0 : n / x + 1;
}

int main()
{
    lint a, b, x;
    cin >> a >> b >> x;

    cout << f(b, x) - f(a - 1, x) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for(int i=(first); i<(last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;

inline int to_int(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string to_string(T x) {ostringstream sout;sout<<x;return sout.str();}


int main() {
  int n, a;
  cin >> n >> a;
  cout << n*n - a << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n,odd=0,by2=0,by4=0;
    cin>>n;
    rep(i,n){
        ll a;
        cin>>a;
        if(a%2==1)   odd++;
        else{
            if(a%4==0)   by4++;
            else    by2++;
        }
    }
    int mergin=by4+1;
    if(by2>0)   mergin--;
    cout<<(mergin-odd>=0?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
mod = 10**9 + 7
ans = 0
a,b = 0,0
for i in range(n):
    a += i
    b += n-i
    if i >= k-1:
        ans += b-a+1
        ans %= mod
    #print(a,b,b-a+1)
print(ans+1)

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

int main()
{
	long long n, a, b;
	scanf("%lld%lld%lld", &n, &a, &b);
	long long full = n / (a + b);
	long long ans = full * a;
	n %= a + b;
	ans += std::min(n, a);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 128
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;


int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}
int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int a[101] = {};
    for(int i = A; i < B; i++){
        a[i] = 1;
    }
    for(int i = C; i <  D; i++){
        a[i] += 1;
    }
    int cnt = 0;
    for(int i = 0; i <= 101; i++){
        if(a[i] == 2)cnt++;
    }


    cout << cnt << endl;
}




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

int main(){
    int a, b;
    int nums[2];
    nums[0] = a;
    nums[1] = b;

    cin >> a >> b;
    if  (a>b) cout << a+(a-1) << endl;
    else if (a==b) cout << a+b << endl;
    else cout << b+(b-1) << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] abc = new int[3];
        abc[0] = Integer.parseInt(sc.next());
        abc[1] = Integer.parseInt(sc.next());
        abc[2] = Integer.parseInt(sc.next());
        int count = 0;
        int dif1 = 0;
        int dif2 = 0;
        if(abc[0] >= abc[1] && abc[0] >= abc[2]) {
            dif1 = abc[0] - abc[1];
            dif2 = abc[0] - abc[2];
        }else if(abc[1] >= abc[0] && abc[1] >= abc[2]) {
            dif1 = abc[1] - abc[0];
            dif2 = abc[1] - abc[2];
        }
        else {
            dif1 = abc[2] - abc[0];
            dif2 = abc[2] - abc[1];
        }
        if(dif1 % 2 == dif2 % 2) {
            if(dif1 % 2 == 0) count = (dif1+dif2)/2;
            else count = (dif1+dif2)/2;
        }else {
            if(dif1 % 2 == 0) count = dif1/2 + (dif2+1)/2 + 1;
            else count = dif2/2 + (dif1+1)/2 + 1;
        }
        System.out.println(count);
    } 
}

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

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

  LL a = (x / 11) * 2;
  LL b = x % 11;
  LL ans = a;
  if (b > 6) ans += 2;
  else if (b > 0) ans += 1;

  cout << ans << endl;
}


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

int main() {
  int k;
  int a[60]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin >> k;
  cout << a[k-1] << endl;
  
  
  
}




  



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

struct rootedTree {
	struct node {
		int bro, chi, par;
	};

	vector<int> dep;
	vector<node> tree;

	rootedTree(int n) :
		dep(n),
		tree(n)
	{
		for (node& i : tree) i.bro = i.chi = i.par = -1;
	}

	int getBrother(int a) {
		return tree[a].bro;
	}

	int getChild(int a) {
		return tree[a].chi;
	}

	int getDepth(int a) {
		return dep[a];
	}

	int getParent(int a) {
		return tree[a].par;
	}

	vector<int> getChildren(int a) {
		int b = tree[a].chi;
		vector<int> res;
		while (b != -1) {
			res.push_back(b);
			b = tree[b].bro;
		}
		return res;
	}

	void setBrother(int a, int newBro) {
		tree[a].bro = newBro;
	}

	void setChild(int a, int newChi) {
		tree[a].chi = newChi;
	}

	void setParent(int a, int newPar) {
		tree[a].par = newPar;
	}

	void updateDepth(int a, int b) {
		dep[a] = b;
		if (tree[a].bro != -1) updateDepth(tree[a].bro, b);
		if (tree[a].chi != -1) updateDepth(tree[a].chi, b + 1);
	}
};

int main() {
	int n, id, k, c, tmp1;
	cin >> n;
	rootedTree rt(n);
	for (int i = 0; i < n; ++i) {
		cin >> id >> k;
		for (int j = 0; j < k; ++j) {
			cin >> c;
			if (j) rt.setBrother(tmp1, c);
			else rt.setChild(id, c);
			tmp1 = c;
			rt.setParent(c, id);
		}
	}
	for (int i = 0; i < n; ++i) {
		if (rt.getParent(i) == -1) {
			tmp1 = i;
			break;
		}
	}
	rt.updateDepth(tmp1, 0);
	for (int i = 0; i < n; ++i) {
		vector<int> tmp2 = rt.getChildren(i);
		cout << "node " << i << ": parent = " << rt.getParent(i) << ", depth = " << rt.getDepth(i) << ", ";
		if (rt.getParent(i) == -1) cout << "root, [";
		else if (rt.getChild(i) == -1) cout << "leaf, [";
		else cout << "internal node, [";
		if (!tmp2.empty()) cout << tmp2[0];
		for (int j = 1; j < tmp2.size(); ++j) cout << ", " << tmp2[j];
		cout << "]" << endl;
	}
}


Measured memory_bytes: 6580
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cstring>
#include <math.h>
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
using namespace std;

int swap(int &a,int &b){
	int c;
	c=a;
	a=b;
	b=c;

	return 0;
}



int main(){
	while(1){
		int y,x;
		cin>>y>>x;
		if(x==0&&y==0)
			break;
		for(int i=1;i<=y;i++){
			for(int j=1;j<=x;j++){
				cout<<'#';
			}
			cout<<endl;
		}
		cout<<endl;

	}

	return 0;
}

Measured memory_bytes: 1152
{-# LANGUAGE TypeApplications #-}

import           Control.Applicative
import           Control.Arrow
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as B
import           Data.Char
import           Data.List
import qualified Data.Vector.Unboxed           as V
import           Data.Maybe

main = do
  [n, d] <- map (read @Int) . words <$> getLine
  replicateM n ((\[x, y] -> (x, y)) . map (read @Int) . words <$> getLine)
    >>= print
    .   length
    .   filter (d * d >=)
    .   map (uncurry (+) . duplicate (***) (duplicate (*)))
  where duplicate f x = f x x



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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {
    ll A,B;
    cin >> A >> B;
    if((A+B)%2==0){
        cout << (A+B)/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}



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

using namespace std;

int main ()
{
    int n, m;

    while (cin >> n >> m, n || m) {
        bool wa[1000];
        int res = n;

        for (int i = 0; i < n; i++)
            wa[i] = true;

        int tm = n - 1;
        while (res > 1) {
            int cnt = 0;
            
            while (cnt < m) {
                tm = (tm + 1) % n;
                if (wa[tm])
                    cnt++;
            }
            wa[tm] = false;
            res--;
        }

        for (int i = 0; i < n; i++)
            if (wa[i])
                cout << i + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n-i+1):
        k = n-i-j
        sum = i*10000 + j*5000 + k*1000
        if sum == y:
            print(i, j, k)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int cnt = 0;
		while (true) {
			cnt++;
			int input = Integer.parseInt(br.readLine());
			if (input == 0) {
				break;
			}
			System.out.println("Case " + cnt + ": " + input);
		}
	}
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 100005

int n;
int a[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int s = 1;
    int ans = 1;
    for(int i = 1; i < n; i++){
        if(a[i] > a[i - 1]){
            ans = max(ans , s);
            s = 1;
        }
        else
            s++;
    }
    cout << max(ans , s) - 1 << endl;
    return 0;
}


Measured memory_bytes: 640
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if abs(a-b) > k or abs(a-c) > k or abs(a-d) > k or abs(a-e) > k or abs(b-c) > k or abs(b-d) > k or abs(b-e) > k or abs(c-d) > k or abs(c-e) > k or abs(d-e) > k:
  print(':(')
else:
  print('Yay!')

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

int main(){
	int N, i;
	scanf("%d", &N);
	for(i = 0; i <= N; i++){
		if((i * 108) / 100 == N){
			printf("%d\n", i);
			return 0;
		}
	}
	printf(":(\n");
	return 00;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int main(){
  std::string s[3];
  long long k,a[3]={};
  std::cin>>s[0]>>k;
  for(size_t i=0;i<2;++i) s[i+1]=s[i]+s[0];
  for(size_t i=0;i<3;++i) for(size_t j=1;j<s[i].length();++j) if(s[i][j]==s[i][j-1]) ++a[i],++j;
  std::cout<<(k&1?a[0]:a[1])+(k-1)/2*(a[2]-a[0])<<std::endl;
  assert(a[0]+a[1]==a[2]||a[0]+a[1]==a[2]-1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout  << std::endl;
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
//#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 2000000000;
//const ll INF64 = 9223372036854775807ll;
const ll INF64 = 9223372036854775ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
//std::vector<vector<int>> g;
int main(){
    int a,b;
    std::cin >> a>>b;
    std::cout << a*b << std::endl;
}

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

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

  int a = n % 10;
  if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
    cout << "hon" << endl;
  }
  else if (a == 0 || a == 1 || a == 6 || a == 8) {
    cout << "pon" << endl;
  }
  else {
    cout << "bon" << endl;
  }

  return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <utility>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, n, x, l, ans = 0, now = -1e12;
  scanf("%lld", &n);
  pair<ll, ll> p[n];
  for(i = 0; i < n; ++i) {
    scanf("%lld%lld", &x, &l);
    p[i].first = x + l;
    p[i].second = x - l;
  }
  sort(p, p + n);
  for(i = 0; i < n; ++i) if(now <= p[i].second) now = p[i].first, ans++;
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 1664
import Control.Monad
import Data.List

convertMaxToHalf :: [Int] -> [Int]
convertMaxToHalf prices = (max `div` 2):remains
  where sorted = reverse . sort $ prices
        max = head sorted
        remains = tail sorted


main :: IO ()
main = do
  count <- readLn
  prices <- replicateM count readLn
  print $ sum $ convertMaxToHalf (prices :: [Int])

Measured memory_bytes: 508
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#define ll  long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define main() int main()
#define ff1(i,n) for(int i=1;i<=n;++i)
#define ff0(i,n) for(int i=0;i<n;++i)
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define fir first
#define sec second
#define debug(x) cout<<x<<'\n'
#define sa(a) scanf("%d", &a)
#define sab(a, b) scanf("%d%d", &a, &b)
#define pa(a) printf("%d",a)
#define pab(a,b) printf("%d%d",a,b)
#define pii pair<ll,ll>
using namespace std;

#define maxn 1000005
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a%mod;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans%mod;
}
main()
{  
    ll n;
	cin>>n; 
    vector<pair<ll, ll>> v;
    for (ll i=2;i*i<=n;i++){
        if (n%i==0) {
            v.pb(pii(i, 0));
            while (0==n%i) {
                v.back().second++;
                n/=i;
            }
        }
    }
    if (n>1) {
        v.pb(pii(n, 1));
    }
    ll ans=0;
    for (pii &p:v) {
        ll i=sqrt(p.second*2);
        if (i*(i+1)>p.second*2)  i--;
        ans+=i;
    }
 
    cout<<ans<<endl;
}
 

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
ll mod=1e9+7;
int main(){
	int n,k;
	ll ans=0LL;
	cin >>n>>k;
	ll up=0LL;
	ll down=0LL;
	int a=0,b=n;
	for(int i=1;i<=n+1;i++){
		up+=a;
		down+=b;
		ans+=(down-up+1);
		
		
		if(i<k){
			ans=0LL;
		}else{
			ans %= mod;
		}
	//	clog<<ans<<endl;
		//clog<<"--"<<a<<" "<<b<<endl;
		a++;
		b--;
	}
	cout<<ans<<endl;
}
/*
0
1 
2
3

0 3
1 5
*/

Measured memory_bytes: 3604
N,M = map(int,input().split())
X = sorted([int(i) for i in input().split()])
subX = sorted([X[i]-X[i-1] for i in range(1,M)],reverse=True)
 
if N >= M:
    print(0)
    exit()
 
answer = X[-1] - X[0]
for i in range(N-1):
    answer -= subX[i]
 
print(answer)

Measured memory_bytes: 13840
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,k;
	cin >> n >> m >> k;
	for(int i=0; i<=n; i++)
		for(int j=0; j<=m; j++){
			if(i*j+(n-i)*(m-j) == n*m-k){
				puts("Yes");
				return 0;
			}
		}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define MAXN 510
#define MAXM 1000010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
typedef long long LL;

int w,h,n,f[MAXN];
int x[MAXN],y[MAXN];

int Find(int u)
{
    return (f[u]&&f[u]!=u)?f[u]=Find(f[u]):u;
}

void Init()
{
    scanf("%d%d%d",&w,&h,&n);
    for(int i=1;i<=n;++i)
        scanf("%d%d",x+i,y+i);
}

void Work()
{
    int i,j;
    double l,r,mid;
    for(l=0,r=1e9;r-l>1e-6;){
        memset(f,0,sizeof(f));
        mid=(l+r)/2;
        for(i=1;i<=n;++i){
            if(x[i]-mid<1e-8) f[Find(i)]=n+1;
            if(x[i]+mid-w>-(1e-8)) f[Find(i)]=n+2;
        }
        for(i=1;i<=n;++i)
            for(j=i+1;j<=n;++j){
                if(mid*2-hypot(x[i]-x[j],y[i]-y[j])>-(1e-8)) f[Find(j)]=Find(i);
            }
        if(Find(n+1)==Find(n+2)) r=mid;
        else l=mid;
    }
    printf("%.3f\n",r);
}

int main()
{
    Init();
    Work();
    return 0;
}

Measured memory_bytes: 2808
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    long long int n, cnt = 0;
    cin >> n;
    
    if(n == 25)
        cout<<"Christmas"<<endl;
    if(n == 24)
        cout<<"Christmas Eve"<<endl;
    if(n == 23)
        cout<<"Christmas Eve Eve"<<endl;
    if(n == 22)
        cout<<"Christmas Eve Eve Eve"<<endl;

}

Measured memory_bytes: 256
Module Module1

    Dim N As Integer = 0
    ' 証言者iがxに対する証言yをtblに保存
    ' tbl(i,x) = y 
    ' ※ただし配列の0から格納していくため1人目の証言者はi=0として以降順番に格納するものとする
    ' y：0⇒不親切, 1⇒正直者 -1⇒証言なし
    Dim tbl(14, 14) As Integer

    Sub Main()

        N = Int(Console.ReadLine)
        Dim result As Integer = 0

        For i As Integer = 0 To 14
            For j As Integer = 0 To 14
                tbl(i, j) = -1
            Next
        Next

        For i As Integer = 0 To N - 1
            Dim a As Integer = Int(Console.ReadLine)
            For j As Integer = 1 To a
                Dim arr() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "), AddressOf Integer.Parse)
                Dim x, y As Integer
                x = arr(0) : y = arr(1)
                tbl(i, x - 1) = y
            Next
        Next

        ' bit全探索（bitで15桁を作成し0桁目をA0とし、1を正直者0を不親切な人とする）
        For i As Int64 = 1 To (1 << N) - 1
            Dim honests(N - 1) As Integer
            ' 
            For j As Integer = 0 To N - 1
                If (i >> j) And 1 Then
                    honests(j) = 1
                End If
            Next
            Dim b As Boolean = True
            For j As Integer = 0 To N - 1
                ' jが正直者であれば証言に矛盾がないか確認する
                If honests(j) = 1 Then
                    For k As Integer = 0 To N - 1
                        ' 証言者jのkに対する証言に矛盾がないかを確認
                        ' 矛盾があれば次へ
                        If tbl(j, k) = -1 Then
                            Continue For
                        ElseIf tbl(j, k) <> honests(k) Then
                            b = False
                            Exit For
                        End If
                    Next
                End If
            Next
            If b Then
                Dim count As Integer = 0
                For k As Integer = 0 To N - 1
                    If honests(k) = 1 Then
                        count = count + 1
                    End If
                Next
                result = Math.Max(result, count)
            End If
        Next
        Console.WriteLine(result)
    End Sub

End Module


Measured memory_bytes: 31340
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] ryuka = new long[n + 1];
        ryuka[0] = 2;
        ryuka[1] = 1;
        for (int i = 2; i < n + 1; i++) {
            ryuka[i] = ryuka[i - 1] + ryuka[i - 2];
        }
        System.out.println(ryuka[n]);
    }
}

Measured memory_bytes: 23892
#include<iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main()
{
    //　数値の定義
    //　文字列の定義
    int A,B,C; //入力文字
    cin >> A;
    cin >> B;
    cin >> C;
    
    // 識別
    int temp;
    temp = A;
    A = B;
    B = temp;

    temp = A;
    A = C;
    C = temp;


    //判定
    cout << A << " " << B << " " << C << endl;

    return 0;
}

Measured memory_bytes: 888
N=int(input())

A_str_list = input().split(' ')
A = [int(x) for x in A_str_list]
B_str_list = input().split(' ')
B = [int(x) for x in B_str_list]
C_str_list = input().split(' ')
C = [int(x) for x in C_str_list]

satis = 0
prev_eat = -2
for ii in range(N):
    satis += B[A[ii]-1]
    if prev_eat + 1 == A[ii]-1 and 0 < ii:
        satis += C[prev_eat]
        #print(C[A[ii]-1])
    prev_eat = A[ii]-1
print(satis)


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

struct Card {
    char c;
    int n;
};

void print_cards(vector<Card> c, int length) {
    cout << c[0].c << c[0].n;
    for (int i = 1; i < length; ++i)
        cout << ' ' << c[i].c << c[i].n;
    cout << '\n';
}

void bubble_sort(vector<Card>& c, int length) {
    for (int i = 0; i < length; ++i) {
        for (int j = length - 1; j > i; --j) {
            if (c[j].n < c[j - 1].n)
                swap(c[j], c[j - 1]);
        }
    }
}

void selection_sort(vector<Card>& c, int length) {
    for (int i = 0; i < length; ++i) {
        int min_idx = i;
        for (int j = i; j < length; ++j) {
            if (c[j].n < c[min_idx].n)
                min_idx = j;
        }
        swap(c[i], c[min_idx]);
    }
}

bool is_stable(vector<Card>& stable, vector<Card>& c, int length) {
    for (int i = 0; i < length; ++i) {
        if (stable[i].c != c[i].c || stable[i].n != c[i].n)
            return false;
    }
    return true;
}

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

    vector<Card> cards(n);
    for (int i = 0; i < n; ++i)
        cin >> cards[i].c >> cards[i].n;

    vector<Card> bubble(n);
    copy(cards.begin(), cards.end(), bubble.begin());
    bubble_sort(bubble, n);

    vector<Card> selection(n);
    copy(cards.begin(), cards.end(), selection.begin());
    selection_sort(selection, n);

    print_cards(bubble, n);
    cout << "Stable\n";

    print_cards(selection, n);
    if (is_stable(bubble, selection, n))
        cout << "Stable\n";
    else
        cout << "Not stable\n";
}



Measured memory_bytes: 3144
#include <iostream>

using namespace std;
int count[51];

int main(void){
	int N,M,a,b;
	cin >> N >> M;
	int i;
	for(i=0;i<M;i++){
		cin >> a >> b;
		count[a]++;
		count[b]++;
	}
	for(i=1;i<=N;i++){
		cout << count[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
import math

A = []
B = []
S = []


if a % 2 == 0:
    for i in range(13):
        A.append(int((12.5*a))+i)
else:
    for i in range(1,13):
        A.append(int((12.5*a))+i)
        

for k in range(10):
    B.append((10*b)+k)
    
if len(list((set(A))& set(B))) > 0:
    S = list((set(A))& set(B))
    print(min(S))
else:
    print(-1)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
long long n,k,ans;
long long calc(long long a,long long b,long long c)
{
	if (a%b>=c) return a/b+1;
	else return a/b;
}
int main()
{
	scanf("%lld%lld",&n,&k);
	for (long long i=1;i<=n;i++)
	{
		long long x=i%k,y=k-x;
		if ((y+y)%k!=0) continue;
		else ans+=calc(n,k,y)*calc(n,k,y);
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += A.at(i)-1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
root = {}

for i in range(m):
    c,d = map(int, input().split())
    if c not in root:
        root[c] = []
    if d not in root:
        root[d] = []
    root[c].append(d)
    root[d].append(c)
sirusi = [0] *(n+1)
dp = [2*m] * (n+1)
dp[1]=0
before = [1]
while True:
    tmp=[]
    flag=0
    for b in before:
        for r in root[b]:
            if dp[r] > dp[b] +1:
                dp[r] = dp[b] +1
                sirusi[r] = b
                flag += 1
                tmp.append(r)
    before = tmp
    if flag == 0:
        break

if sirusi.count(0)>2:
    print("No")
    exit()

print("Yes")
for i in range(2,n+1):
    print(sirusi[i])

Measured memory_bytes: 39056
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
int a,b,c;
int main(){
    cin >> a >> b >> c;
    cout << ((c-a)*(c-b) < 0 ? "Yes" : "No") << endl;
}

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

int main(){
  unsigned long long n, v, a = 0, b = 0, c = 0, d = 0, e = 0;
  std::cin >> n;
  while(n--) {
    std::cin >> v;
    a += v;
    b = std::min(b + (v ? v % 2 : 2), a);
    c = std::min(c + (v + 1) % 2, b);
    d = std::min(d + (v ? v % 2 : 2), c);
    e = std::min(e + v, d);
  }
  std::cout << e << std::endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=input()
b=input()
c=input()

ans=0
for i in range(n):
    x,y,z=a[i], b[i], c[i]
    if x==y and y==z:
        continue
    elif x!=y and y!=z and z!=x:
        ans+=2
    else:
        ans+=1
print(ans)

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

int main(){
  int n;
  cin >> n;
  vector<int> an(n);
  ll tot = 0;
  for(int i=0; i<n; ++i){
    cin >> an[i];
    tot += an[i];
  }
  ll ans = tot;
  ll tot2 = 0;
  for(int i=0; i<n-1; ++i){
    tot2 += an[i];
    ans = min(ans, abs(tot -tot2*2));
  }
  cout << ans << endl;
}

Measured memory_bytes: 4024
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(auto &i:a){cin>>i;}
    sort(a.begin(),a.end());
    ll X=0;
    ll last=0;
    for(int i=0;i<n;i++){
        if((a[i]-last)&1){X^=n-i;}
        last=a[i];
    }
    cout<<(X==0?"second":"first")<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 1024
s = int(input())
a = set([s])
for i in range(2, 1000000):
  if s % 2 == 0:
    t = s // 2
  else:
    t = 3 * s + 1
  if t in a:
    print(i)
    exit()
  a.add(t)
  s = t

Measured memory_bytes: 2940
#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 2e9
#define ll long long
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ALL(v) v.begin(), v.end()

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

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

int main(){
    int a,s,ans = 0;
    int N, M, C; cin >> N >> M >> C;
    vector<int> B(M); REP(i, M) cin >> B.at(i);
    REP(i, N) {
        s = 0;
        REP(j, M) {
            cin >> a;
            s += a*B.at(j);
        }
        if (s+C>0) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int a[1000000][2];

int main()
{
    int n,i,k=0;
    cin >> n;
    for(i = 1;i <= n;i++)
    {
        cin >> a[i-1][0];
        a[i-1][1] = i;
    }
    for(i = 0;i < n;i++)
    {
        if(a[i][0]%2!=0 &&a[i][1]%2!=0)
            k++;
    }
    cout << k <<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main (void)
{
	int W,H,x,y,r,a,b;
	
	scanf("%d %d %d %d %d\n",&W,&H,&x,&y,&r);
	
	a=x+r;
	b=y+r;
	
	if(a>0 && a<=W && b>0 && b<=H)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 588
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long a[2000],b[2000],c[2000];
const int maxn=1e6;
const int N=1e7;
long long ans[N];
long long d[maxn];
bool cmp(long long a,long long b){
    return a>b;
}
int main(){
    int x,y,z,k;
    cin>>x>>y>>z>>k;
    for(int i=0;i<x;i++)
        cin>>a[i];
    for(int i=0;i<y;i++)
        cin>>b[i];
    for(int i=0;i<z;i++)
        cin>>c[i];
    sort(c,c+z,cmp);
    int cnt=0;
    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            d[cnt++]=a[i]+b[j];
        }
    }
    cnt=0;
    sort(d,d+x*y,cmp);
    int f=min(3000,x*y);
    for(int i=0;i<f;i++){
        for(int j=0;j<z;j++){
            ans[cnt++]=d[i]+c[j];
            //cout<<i*f+j<<endl;
        }
    }
    cnt=f*z;
    sort(ans,ans+cnt,cmp);
    for(int i=0;i<k;i++){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 33024
fun main(args: Array<String>) {
    a79(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a79(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val sortedNumList = args[0].toList()
    println(if (sortedNumList.take(3).toSet().size == 1 || sortedNumList.takeLast(3).toSet().size == 1) "Yes" else "No")
}

Measured memory_bytes: 33832
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(void){
	int a;
	int b;
	int c;
	int i = 0;
	scanf("%d %d %d", &a, &b, &c);
	for(;a <= b;a++){
		if(c % a == 0) i++;
	}
	printf("%d\n", i);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define N 100003
#define endl "\n"

#define trace1(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 trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;


using namespace std;

int main() {
	// for fast input output using cin cout
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	// size of array
	// input
	long long x, y;
	cin >> x >> y;
	long long a = x, b = 2 * x;
	long long ans = 1;
	long long lcm;
	while(b <= y) {
		ans++;
		a = b;
		b *= 2;
	}

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

Measured memory_bytes: 256
N, K = [int(i) for i in input().split()]

M = (N - 1) * (N - 2) // 2 - K
if M < 0:
    print(-1)
    quit()

ans = []
for i in range(2, N + 1):
    ans.append((1, i))

u = 2
v = 1
for _ in range(M):
    if u + v > N:
        u += 1
        v = 1
    ans.append((u, u + v))
    v += 1

print(len(ans))
for a in ans:
    print(*a)


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

using namespace std;

int main(){
    long long int X,Y,A,B,C,ans=0;
    cin >> X >> Y >> A >> B >> C;
    long long int na=A-1,nb=B-1,nc=C-1,sum=X+Y;
    pair <long long int,int> P;
    vector<pair<long long int,int>> pqr;

    P.second = 1;

    for(int i=0;i<A;i++){
        cin >> P.first;
        pqr.push_back(P);
    }

    P.second = 2;

    for(int i=0;i<B;i++){
        cin >> P.first;
        pqr.push_back(P);
    }

    P.second = 3;

    for(int i=0;i<C;i++){
        cin >> P.first;
        pqr.push_back(P);
    }

    sort(pqr.begin(),pqr.end());

    for(int i=A+B+C-1;;i--){

        if(sum==0){
            break;
        }

        if(0<X && pqr[i].second==1){
            ans +=pqr[i].first;
            X--;
            sum--;
        }else if(0<Y && pqr[i].second==2){
            ans += pqr[i].first;
            Y--;
            sum--;
        }else if(pqr[i].second==3 && 0<sum){
            ans += pqr[i].first;
            sum--;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 10604
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

#define LL long long

int main() {
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    if (e - a > k) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    N = input()
    l = len(N)

    sum = 0
    for i in range(l):
        if i % 2 == 1:
            continue
        elif i == l - 1:
            sum += int(N) - 10 ** (l - 1) + 1
        else:
            sum += 9 * (10 ** i)

    print(sum)



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

int main(){
    int n;
    long long ans;
    long long tmp1=1,tmp2=1;
    cin>>n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        tmp1*=3;
        if(a%2==0){
            tmp2*=2;
        }
    }
    cout<<tmp1-tmp2<<endl;
    return 0;
}

Measured memory_bytes: 3580
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 500000

struct node
{
    int key;
    struct node* p;
    struct node *l, *r;
} typedef node;

void Insert(node*);
void Inorder(node*);
void Preorder(node*);

node *root = NULL;

int main()
{
    int i;
    int n;
    int key;
    char order[7];
    node *new;

    scanf("%d", &n);
    for(i = 0; i < n; i++)
    {
        scanf("%s", order);
 
        if(strcmp(order, "insert") == 0)
        {
            new = (node*)malloc(sizeof(node));
	        scanf("%d", &(new->key));
	        new->l = NULL;
	        new->r = NULL;
	        Insert(new);
	    }
        if(strcmp(order, "print") == 0)
        {
            Inorder(root);
            printf("\n");
            Preorder(root);
            printf("\n");
        }
    }
    return 0;
}

void Insert(node *z)
{
    node *x, *y;

    y = NULL;
    x = root;

    while(x != NULL)
    {
        y = x;
        if(z->key < x->key) x = x->l;
        else x = x->r;
    }
    z->p = y;

    if(y == NULL) root = z;
    else if(z->key < y->key) y->l = z;
    else y->r = z;
}  

void Inorder(node *x)
{
    if(x == NULL) return;

    Inorder(x->l);
    
    printf(" %d", x->key);
    
    Inorder(x->r);
}

void Preorder(node *x)
{
    if(x == NULL) return;
    
    printf(" %d", x->key);

    Preorder(x->l);
    Preorder(x->r);
}

Measured memory_bytes: 24036
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007

int num[200010],sum[200010],f[200010],n;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline int pls(const int &x,const int &y) { return (x+y<mod)?x+y:x+y-mod; }

int main()
{
	n=rd();
	for (int i=1;i<=n;i++)
	{
		num[i]=rd();
		if (i>1&&num[i]==num[i-1]) n--,i--;
	}
	sum[0]=1;
	for (int i=1;i<=n;i++) sum[num[i]]=pls(sum[num[i]],sum[num[i-1]]);
	printf("%d\n",sum[num[n]]);
	return 0;
}

Measured memory_bytes: 1792
import sys
a, b=map(int, input().split())
s=input()
for i in range(a+b+1):
  if i==a:
    if s[i]!='-':
      print("No")
      sys.exit()
  else:
    if ord(s[i])-ord('0')<0 or ord(s[i])-ord('0')>9:
      print("No")
      sys.exit()
print("Yes")

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



int main(){
	long long A , B , K ;
	int i , j ;
	bool t = true ;
	scanf("%lld%lld%lld",&A,&B,&K);

	for( i = 0 ; i < K ; i++ ){
		if(t){
			A = A / 2 ;
			B = B + A ;
		}
		else {
			B = B / 2 ;
			A = A + B ;
		}
		t = !t ;
	}
	cout << A << " " << B << endl ;
	return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long a, b;

int main() {
    cin >> a >> b;
    long long ans = 0;
    if(b-a >= 10) {
        vector<long long> check;
        long long first = 0;
        for(long long i = a; i < a+10; ++i) {
            first ^= i;
            check.push_back(first);
        }

        long long eq = 0;
        long long fst = 0;
        bool flg = false;
        for(int i = 0; i < check.size(); ++i) {
            for(int j = i+1; j < check.size(); ++j) {
                if(check.at(i) == check.at(j)) {
                    eq = check.at(i);
                    fst = a+(long long)j;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

        long long no = (b-fst)/4;
        long long nomax = 4*no+fst;
        for(long long i = nomax+1; i <= b; ++i) eq ^= i;

        cout << eq << endl;

    }else {
        for(long long i = a; i <= b; ++i) {
            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)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        xn:[i64;n],
    }
    let sum = xn.iter().sum::<i64>();
    let mut ans = 1e9 as i64;
    for j in 0..n {
        let cal = xn.iter().take(j).sum::<i64>();
        let sub = sum - cal;
        ans = min(ans,(cal-sub).abs());
    }
    println!("{}",ans);
}

Measured memory_bytes: 4352
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;

  bool b = false;
  for(int i = 1; i <= 9 ; i++)
  for(int j = 1; j <= 9 ; j++)  {
    if(i * j == n)
    {
      b = true;
      break;
    }
  }

  cout << ( b ? "Yes" : "No");
  
  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  int prev_sum = 0;
  int max_sum = 0;    
  for(int i = 0; i < (n - (k - 1)); ++i) {
    int sum = 0;
    if(i == 0) {
      for(int j = 0; j < k; ++j) {
        sum += v[i + j];
      }
    } else {
      sum = prev_sum - v[i - 1] + v[i + (k - 1)];
    }
    max_sum = max(max_sum, sum);
    prev_sum = sum;
  }
  cout << fixed << setprecision(10) << ((double)max_sum + k)/2 << endl;
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main{
    
    static final int MOD = (int)1e9+7;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        long[] b = new long[n];
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
            b[i] = (((long)a[i])<<32) + i;
        }
        
        Arrays.sort(b);
        //reverse
        for(int i=0; i<n/2; i++){
            long tmp = b[i];
            b[i] = b[n-1-i];
            b[n-1-i] = tmp;
        }
        
        long[][] dp = new long[n+1][n+1];
        
        for(int i=0; i<n; i++){
            for(int j=0; i+j<n; j++){
                long v = b[i+j]>>32;
                int idx = (int)b[i+j];
                //left(idx - i)
                dp[i+1][j] = Math.max(dp[i+1][j], dp[i][j]+v*(idx - i));
                //right(n-1-j - idx)
                dp[i][j+1] = Math.max(dp[i][j+1], dp[i][j]+v*(n-1-j - idx));
            }
        }
        
        long ans = 0;
        for(int i=0; i<n; i++){
            ans = Math.max(ans, dp[i][n-i]);
        }
        
        System.out.println(ans);
        
    }
}


Measured memory_bytes: 86700
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.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;}
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

using Graph = vector<vector<ll>>;



int main(){
  int n;
  cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll ans=0;
  ll sum=a[0];
  Rep(i,1,n){
    ans=(ans+sum*a[i])%mod;
    sum=(sum+a[i])%mod;    
  }
  cout<<ans<<endl;
  
    
    
  return 0;
}


Measured memory_bytes: 4840
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    ans = 0
    for i in range(n):
        if not i&1:
            if a[i]&1:
                ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 67200