akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long H;
  scanf("%lld", &H);
  long long A;
  scanf("%lld", &A);

  put((H + A - 1) / A);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 256
#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;
  bool isYin = false;
  rep(i, N)
  {
    string Si;
    cin >> Si;
    if (Si == "Y")
    {
      isYin = true;
      break;
    }
  }
  if (isYin)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}

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

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def main():
    x, y = map(int, input().split())

    if x < x * (y//gcd(x, y)):
        print(x)
    else:
        print(-1)
    


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int x[5],y[5],xx,yy;
	scanf("%d %d %d %d",&x[1],&y[1],&x[2],&y[2]);
	xx=x[2]-x[1];xx=abs(xx);
	yy=y[2]-y[1];yy=abs(yy);

	if(x[1]>=x[2]&&y[1]>=y[2]){
		x[3]=x[2]+yy;
		y[3]=y[2]-xx;
		x[4]=x[3]+xx;
		y[4]=y[3]+yy;
	}
	else if(x[1]<=x[2]&&y[1]<=y[2]){
		x[3]=x[2]-yy;
		y[3]=y[2]+xx;
		x[4]=x[3]-xx;
		y[4]=y[3]-yy;
	}
	else if(x[1]<=x[2]&&y[1]>=y[2]){
		x[3]=x[2]+yy;
		y[3]=y[2]+xx;
		x[4]=x[3]-xx;
		y[4]=y[3]+yy;
	}
	else if(x[1]>=x[2]&&y[1]<=y[2]){
		x[3]=x[2]-yy;
		y[3]=y[2]-xx;
		x[4]=x[3]+xx;
		y[4]=y[3]-yy;
	}
	printf("%d %d %d %d\n",x[3],y[3],x[4],y[4]);
return 0;
}

Measured memory_bytes: 256
<?php
class node
{
    public $a;
    public $b;
    public function __construct($var1,$var2)
    {
        $this->a = $var1;
        $this->b = $var2;
    }
}
$arr = array();
fscanf(STDIN,"%d %d",$N,$M);
for($i = 0;$i < $M;$i++)
{
    fscanf(STDIN,"%d %d",$a,$b);
    if(!isset($arr[$a]))
       $arr[$a] = $b;
    else{
        $arr[$a] = min($arr[$a],$b);
    }
}
$array = array();
for($i = 1;$i <= $N;$i++)
{
    if(isset($arr[$i]))
    {
      array_push($array,new node($i,$arr[$i]));
    }
}
function cmp($var1,$var2)
{
    return $var1->b > $var2->b;
}
usort($array,"cmp");
$len = count($array);
/*for($i = 0;$i < $len ;$i++)
{
    echo $array[$i]->a;
    echo " ";
    echo $array[$i]->b;
    echo"\n";
}*/
if($len === 0)
{
    echo "0\n";
}
else 
{
    $cnt = 1;
    $m_right = $array[0]->b-1;
    for($i = 1;$i < $len;$i++)
    {
        if($array[$i]->a <= $m_right)
        {
            continue;
        }
        $cnt++;
        $m_right = $array[$i]->b-1;
    }
    echo $cnt."\n";
}

Measured memory_bytes: 25460
#include <stdio.h>
#include <iostream>
#include <string>
int main(void)
{
	int a, b, h, s;
	std::cin >> a >> b >> h;

	if (a == b && a == h && b == h)
	{
		s = 1;
	}
	else if (a != b && a != h && b != h)
	{
		s = 3;
	}
	else
		s = 2;
	std::cout << s;
	return 0;
}
	

		
	

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;

int gcd(int n, int m){

    if(n == 0 ) return m;
    if(m == 0 ) return n;

    if(m > n)  return gcd(m, n);

    int r = n % m;
    if(r == 0) return m;
    else       return gcd(m, r);
}

int main(){

    int n; cin >> n;

    int a[n], b[n];

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

    int l[n], r[n];

    l[0] = 0;
    l[1] = a[0];
    for(int i=2; i<n; i++){
        l[i] = gcd(l[i-1], a[i-1]);
    }

    r[n-1] = 0;
    r[n-2] = a[n-1];
    for(int i=n-3; i>=0; i--){
        r[i] = gcd(r[i+1], a[i+1]);
    }

    int ans = 0;
    for(int i=0; i<n; i++){
        // cout << i << endl;
        ans = max(gcd(l[i], r[i]), ans);
    }

    cout << ans;



    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	string s;
	int ans = 0;
	cin >> s;
	for (char c : s)
		if (c == 'o')
			ans++;
	ans += 15 - (int)s.length();
	if (ans >= 8)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
import copy
b=copy.deepcopy(a)
b.sort()
if n%2==0:
    half=b[n//2-1]
else:
    half=b[n//2]
for i in range(n):
    if a[i]<=half:
        print(b[n//2])
    else:
        print(b[n//2-1])



Measured memory_bytes: 25620
n = int(input())
a_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_list.append([a, b])
a_list.sort(key=lambda x: x[1])
temp = 0
ans = "Yes"
for i, j in a_list:
    temp += i
    if temp <= j:
        continue
    else:
        ans = "No"
        break
print(ans)

Measured memory_bytes: 38044
#include <iostream>

const int MAX = 100010;
int main()
{
	using namespace std;
	int N, T;
	cin >> N >> T;
	int A[MAX] = { 0 };
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		int a, b;
		cin >> a >> b;
		A[a]++;
		A[b]--;
	}
	for (int i = 1; i <= T; i++)
	{
		ans = ans > A[i-1] ? ans : A[i-1];
		A[i] += A[i - 1];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3492
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int X = in.nextInt();
        int Y = in.nextInt();
        int Z = in.nextInt();
        
      System.out.print(Z);
      System.out.print(" ");
      System.out.print(X);
      System.out.print(" ");
      System.out.print(Y);
    }
}

Measured memory_bytes: 21204
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> p_ii;

int h, w, n;

bool outrange(int y, int x) {
	return (x <= 0 || x >= w-1 || y <= 0 || y >= h-1);
}


int main() {
	int i, j, k; 
	cin >> h >> w >> n;
	map <p_ii, int> square;
	set<p_ii> check;

	for (i = 0; i < n; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		for (j = -1; j <= 1; j++) {
			for (k = -1; k <= 1; k++) {
				if (outrange(a + j, b + k))continue;
				if (check.count({ a + j, b + k }) == 0) {
					check.insert({ a + j,b + k });
					square[{a + j, b + k}] = 0;
				}
				square[{a + j, b + k}]++;
			}
	    }
	}

	map<int, ll> ans;
	for (i = 0; i < 10; i++)ans[i] = 0;

	for (auto itr = check.begin(); itr != check.end(); itr++) {
		ans[square[*itr]]++;
	}

	ans[0] = (ll)(h - 2)*(w - 2) - check.size();

	for (i = 0; i < 10; i++) {
		cout << ans[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 98688
H, W = map(int, input().split())
S = [input() for _ in range(H)]
yoko = [[0] * W for _ in range(H)]
tate = [[0] * W for _ in range(H)]

for h in range(H):
    d = []
    for w in range(W):
        if S[h][w] == ".":
            d.append([h, w])
            if W != w+1: continue
        for h, w in d:
            yoko[h][w] = len(d)
        d = []

for w in range(W):
    d = []
    for h in range(H):
        if S[h][w] == ".":
            d.append([h, w])
            if H != h+1: continue
        for h, w in d:
            tate[h][w] = len(d)
        d = []
        
ans = 0
for h in range(H):
    for w in range(W):
        if ans < yoko[h][w]+tate[h][w]-1:
            ans = yoko[h][w]+tate[h][w]-1
print(ans)

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> places;
  places.reserve(M);
  
  for (int m = 0; m < M; ++m) {
    int p;
    cin >> p;
    places.push_back(p);
  }
  sort(places.begin(), places.end());
  
  vector<int> distances;
  distances.reserve(M-1);
  
  for (int i = 1; i < M; ++i) {
    distances.push_back(places[i] - places[i-1]);
  }
  sort(distances.begin(), distances.end());
  
  int res = 0;
  for (int i = 0; i < M-N; ++i) {
    res += distances[i];
  }
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
 int a,b,i,num=0;
 scanf("%d",&a);
 scanf("%d",&b);
 for(i=0;i<2;i++){
  if(a>b){
    num=num+a;
    a--;
  }
  else{
    num=num+b;
    b--;
  }
 }
 printf("%d",num);
}

Measured memory_bytes: 128
s,t = map(str, input().split())
a,b = map(int, input().split())
u = input()

s_dic = {}
t_dic = {}

s_dic[s] = a
t_dic[t] = b

if u in s_dic:
    s_dic[s] -= 1
elif u in t_dic:
    t_dic[t] -= 1

ans = str(s_dic[s]) + ' ' + str(t_dic[t])

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <tr1/unordered_map>
#define ri register int
#define ptf printf
using namespace std;
typedef double db;
typedef long double ld;
typedef long long ll;
typedef vector <int> poly;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
typedef unsigned long long ulll;
typedef unsigned int uii;
typedef string strr;
#define fi first
#define se second
#define pb push_back
#define ppp pop_back
#define rez resize
const ll Inf = 2e18;
const int rlen = 1 << 20, inf = 0x3f3f3f3f;
char buf[rlen], *ib = buf, *ob = buf;
#define gc() getchar()//(((ib == ob) && (ob = (ib =  buf) + fread(buf, 1, rlen, stdin)), ib == ob) ? -1 : *ib++)
inline int read() {
  static int ans, f;
  static char ch;
  ans = 0, ch = gc(), f = 1;
  while (!isdigit(ch)) f ^= ch == '-', ch = gc();
  while (isdigit(ch)) ans = (ans << 3) + (ans << 1) + (ch ^ 48), ch = gc();
  return f ? ans: -ans;
}
inline ll readl() {
  static ll ans;
  static char ch;
  for (ans = 0, ch = gc(); !isdigit(ch); ch = gc());
  while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ch = gc();
  return ans;
}
inline int Read(char *s) {
  static int top;
  static char ch;
  top = 0, ch = gc();
  while (!isalpha(ch) && !isdigit(ch)) ch = gc();
  while (isalpha(ch) || isdigit(ch)) s[++top] = ch, ch = gc();
  return top;
}
namespace modular {
  const int mod = 998244353;//= 1e9 + 7;
  //int mod;
  int ret;
  inline int add(int a, int b) { return a + b < mod ? a + b : a + b - mod; }
  inline int dec(int a, int b) { return a < b ? a - b + mod : a - b; }
  inline int mul(int a, int b) { return (ll) a * b % mod; }
  inline void Add(int &a, int b) { a = a + b < mod ? a + b : a + b - mod; }
  inline void Dec(int &a, int b) { a = a < b? a - b + mod : a - b; }
  inline void Mul(int &a, int b) { a = (ll) a * b % mod; }
  inline int ksm(int a, int p) {
    for (ret = 1; p; p >>= 1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
    return ret;
  }
  inline int Inv(int a) { return ksm(a, mod - 2); }
  inline int sqr(int a) { return (ll) a * a % mod; }
  inline int cub(int a) { return (ll) a * a % mod * a % mod; }
} using namespace modular;
template <typename T> inline void ckmax(T &a, T b) { a < b ? a = b : 0; }
template <typename T> inline void ckmin(T &a, T b) { a > b ? a = b : 0; }
template <typename T> inline T Abs(T a) { return a < 0 ? -a : a; }
template <typename T> inline T gcd(T a, T b) {
  T t;
  while (b) t = a, a = b, b = t - t / a * a;
  return a;
}
template <typename T> inline void exgcd(T a, T b, T &x, T &y) {
  if (!b) {
    x = 1, y = 0;
    return;
  }
  exgcd(b, a - a / b * b, y, x);
  y -= a / b * x;
}
const int N = 1e6 + 5;
int n;
char s[N];
int a[N];
int main() {
  #ifdef ldxcaicai
  freopen("lx.in", "r", stdin);
  #endif
  int x = read(), y = read();
  for (ri i = 0; i <= x; ++i) {
    if (2 * i + (x - i) * 4 == y) return cout << "Yes", 0;
  }
  cout << "No";
  return 0;
}

Measured memory_bytes: 3624
N, M = map(int, input().split())
ans = 0
pen = 0
w = [0]*(N+1)
ac = [False]*(N+1)
for _ in range(M):
    p, s = input().split()
    if s == "AC" and not ac[int(p)]:
        pen += w[int(p)]
        ac[int(p)] = True
        ans += 1
    elif s == "WA":
        w[int(p)] += 1
print(ans, pen)

Measured memory_bytes: 4596
#include<iostream>
#include<string>
#include<algorithm>
#include<sstream>
using namespace std;

int main(){
	stringstream ss[99];
	int dp[99][99]={0};
	string s;
	int i,numline,col;
	char c;
	for(i=0;getline(cin,s);i++){
		ss[i]<<s;
	}
	numline=i,col=1;
	ss[0]>>dp[0][0];
	for(i=1;i<numline/2+1;i++){
		ss[i]>>dp[i][0];
		dp[i][0]+=dp[i-1][0];
		for(int j=1;j<col+1;j++){
			ss[i]>>c>>dp[i][j];
			dp[i][j]+=max(dp[i-1][j-1],dp[i-1][j]);
		}
		col++;
	}
	for(;i<numline;i++){
		ss[i]>>dp[i][0];
		dp[i][0]+=max(dp[i-1][0],dp[i-1][1]);
		for(int j=1;j<col-1;j++){
			ss[i]>>c>>dp[i][j];
			dp[i][j]+=max(dp[i-1][j],dp[i-1][j+1]);
		}
		col--;
	}
	cout<<dp[i-1][0]<<endl;
	return 0;
}

Measured memory_bytes: 1356
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}
ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){if(b==0) return a; return gcd(b, a%b);}
bool isPrime(int x){
    if(x==1) return false;
    else if(x==2) return true;
    else if(x%2==0) return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0){
            return false;
        }
    }
    return true;
}
int dp[100100];
int main(){
    fast_io
    
    int n;
    cin>>n;
    int a[n];
    int MAX=0;
    rep(i,n) {
        cin>>a[i];
        if(a[i]!=0){
            dp[a[i]-1]++;
        }
        dp[a[i]]++;
        dp[a[i]+1]++;
        MAX=max(MAX, a[i]);

    }
    int ans=0;
    rep(i,MAX+1){
        ans=max(ans, dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b; 
    cin >> a >> b;
    for(int i=1;i <= 10000;i++){
        if(floor(i*0.08) == a && floor(i*0.1) == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint a, b, c; cin >> a >> b >> c;
    cout << ((c - a - b) > 0 and (c - a - b) * (c - a - b) > 4 * a * b ? "Yes" : "No") << "\n";
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) if((x)>(y))(x)=(y)
#define chmax(x,y) if((x)<(y))(x)=(y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b, c, k;

signed main() {
	cin >> a >> b >> c >> k;
	int m = tmax(a,b,c);
	int r = a + b + c - m;
	rep(i,k) m *= 2;
	r += m;
	cout << r << ln;
}

Measured memory_bytes: 256
a = list(map(int, input().split()))
commands = input()
for command in commands:
    if command == 'N':
        a[0], a[1], a[5], a[4] = a[1], a[5], a[4], a[0]
    elif command == 'S':
        a[0], a[1], a[5], a[4] = a[4], a[0], a[1], a[5]
    elif command == 'W':
        a[0], a[3], a[5], a[2] = a[2], a[0], a[3], a[5]
    elif command == 'E':
        a[0], a[3], a[5], a[2] = a[3], a[5], a[2], a[0]
print(a[0])

Measured memory_bytes: 6736
//Name: Day Count
//Level: 2
//Category: 日付
//Note: 

/**
 * 1年1月0日からの経過日数を求める関数を作ればよい。
 *
 * オーダーは O(1)。
 */
#include <iostream>

using namespace std;

int calc(int y, int m, int d) {
    static const int DAYS[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int ans = 0;
    ans += (y-1) * 365 + (y-1)/4 - (y-1)/100 + (y-1)/400;
    for(int i = 1; i < m; ++i) ans += DAYS[i];
    if(m > 2 && (y%4 == 0 && (y%100 != 0 || y%400 == 0))) ++ans;
    ans += d;
    return ans;
}

bool solve(bool first) {
    int y1, m1, d1, y2, m2, d2;
    cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
    if(y1 < 0 || m1 < 0 || d1 < 0 || y2 < 0 || m2 < 0 || d2 < 0) return false;
    cout << calc(y2, m2, d2) - calc(y1, m1, d1) << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) first = false;
    return 0;
}

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

#define line "\n"
#define loop(i,a,n) for(ll i=a;i<n;i++)
#define ll long long int
#define lb long double
#define ull unsigned long long int
#define pb push_back
#define vi vector < int >
# define vs vector < string >
# define vb vector < bool >

# define pii pair < int , int >
# define pll pair < ll , ll >   
# define pld pair < ld , ld >
# define pDD pair < D , D >


# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
using namespace std;
void solve()
{
string s,t;
cin>>s>>t;int count=0;
loop(i,0,s.size())
{
    if(s[i]!=t[i])
count++;
}cout<<count;
}
int main()
{fast
//ll t;
//cin>>t;
//while(t--)
{
solve();
}

}



Measured memory_bytes: 3788
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
const int N = 1e5 + 10;
int n, a[N]; LL s[N], mn[N];
int main() {
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	sort(a + 1, a + n + 1);
	rep(i,1,n) s[i] = s[i - 1] + a[i];
	rep(i,0,n) mn[i] = max(mn[i - 1], (a[i] + 1) / 2 - s[i - 1]);
	int ans = 0;
	dep(i,n,1) {
		if (a[i] >= mn[i - 1]) ans++;
		if (s[i - 1] * 2 < a[i]) break;
	}
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  map<int,int> mp;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
    mp[vec[i]]++;
  }
  
  int cnt = N;
  for(int i=0; i<N; i++){
    if(vec[i] == 1){
      if(mp[1] > 1){
        cnt--;
      }
      continue;
    }
    for(int n=1; n*n<=vec[i]; n++){
      if(vec[i] %n == 0){
        if(n == 1){
          if(mp[vec[i]] > 1){
            cnt--;
            break;
          }
          if(mp.count(1)){
            cnt--;
            break;
          }
        }
        else{
          if(mp.count(vec[i]/n)){
            cnt--;
            break;
          }
          if(mp.count(n)){
            cnt--;
            break;
          }
        }
      } 
    }
  }
  cout << cnt << endl;
}    



Measured memory_bytes: 13524
let id x = x

let rec n_prime f x =
  let rec is_dividable l m =
    (m >= l * l) && ((x mod l = 0) || is_dividable (l + 1) m) in
  if is_dividable 2 x then n_prime f (f x) else x

let _ =
  try
    while true do
      let x = Scanf.scanf "%d\n" id in
      Printf.printf "%d %d\n" (n_prime (fun i -> i - 1) (x - 1)) (n_prime (fun i -> i + 1) (x + 1))
    done
  with
    End_of_file -> ()

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

using namespace std;

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

typedef long long int ll;

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

	int n;
	cin >> n;

    int ans = 0;
	string temp = "";
	while(n >= 1)
	{
		temp = to_string(n);
		if(temp.size()&1)
			ans++;
		n--;
	}
	cout << ans;
	return 0;
}


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

#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(), x.end()

int const N = 100 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  string s;
  cin >> s;

  if(s.size() < 4 || s.substr(0, 4) != "YAKI")
    cout << "No";
  else
    cout << "Yes";
}

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


int N, X, T;

int main() {
	cin >> N >> X >> T;

	if (N%X==0)
	{
		cout << N / X * T << endl;
	}
	else {
		cout << N / X * T + T << endl;
	}
}

Measured memory_bytes: 3600
//Bellman-Ford
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
//tuple -> TLE
#include <iostream>
#include <vector>
//#include <tuple>
using namespace std;

const int inf = 1001001001;

int main()
{
    int n, m, r;
    cin >> n >> m >> r;
    int d[n];
    // vector<vector<pair<int,int>> > edge(n);
    //tuple<int, int, int> edge[m];
    int S[m], T[m], D[m];
    for (int i = 0; i < m; i++)
    {
        int s, t, d;
        cin >> s >> t >> d;
        S[i] = s;
        T[i] = t;
        D[i] = d;
        //edge[i] = make_tuple(s, t, d);
    }
    for (int i = 0; i < n; i++)
    {
        d[i] = inf;
    }
    d[r] = 0;
    for (int i = 0; i < n - 1; i++)
    {
        bool update = false;
        for (int j = 0; j < m; j++)
        {
            /*
            if (d[get<1>(edge[j])] > d[get<0>(edge[j])] + get<2>(edge[j]))
            {
                d[get<1>(edge[j])] = d[get<0>(edge[j])] + get<2>(edge[j]);
            }
            */
            if (d[T[j]] > d[S[j]] + D[j])
            {
                d[T[j]] = d[S[j]] + D[j];
                update = true;
            }
        }
        if (!update)
        {
            break;
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (d[i] == inf)
        {
            cout << "INF" << endl;
        }
        else
        {
            cout << d[i] << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 9160
# ABC 56 B

def resolve():
    w, a, b = map(int, input().split())
    ans = 0

    if a < b < a+w or a < b+w < a+w:
        ans = 0
    elif a+w < b:
        ans = b - (a+w)
    elif b+w < a:
        ans = a - (b+w)

    print(ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
n = int(input())
dat = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    dat.append((s, p, i+1))
res = sorted(dat, key=lambda x: (x[0], -x[1]))
for i in range(len(res)):
    print(res[i][2])

Measured memory_bytes: 38384
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

int main() {
	ll n;
	int ans = INF;
	cin >> n;
	for (ll i = 1, k = sqrt(n); i <= k; ++i) {
		if (n % i == 0) {
			int a = log10(i) + 1;
			int b = log10(n / i) + 1;
			ans = min(ans, max(a, b));
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

// {{{
// source: https://github.com/raahii/algo
func MaxInts(nums ...int) int {
	var maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxVal = e
		}
	}
	return maxVal
}

func MaxIntsWithIdx(nums ...int) (int, int) {
	var maxIdx, maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxIdx = i
			maxVal = e
		}
	}
	return maxVal, maxIdx
}

func MinInts(nums ...int) int {
	var minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minVal = e
		}
	}
	return minVal
}

func MinIntsWithIdx(nums ...int) (int, int) {
	var minIdx, minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minIdx = i
			minVal = e
		}
	}
	return minVal, minIdx
}

func SumInts(nums []int) int {
	s := 0
	for _, v := range nums {
		s += v
	}
	return s
}

func ReverseInts(nums []int) []int {
	rnums := make([]int, len(nums))
	for i := 0; i < len(nums); i++ {
		rnums[len(nums)-1-i] = nums[i]
	}
	return rnums
}

func ExtendInts(nums1 []int, nums2 []int) []int {
	for _, v := range nums2 {
		nums1 = append(nums1, v)
	}
	return nums1
}

func Ints2d(n_rows, n_cols int) [][]int {
	ints := make([][]int, n_rows)
	for i := 0; i < n_rows; i++ {
		ints[i] = make([]int, n_cols)
	}
	return ints
}

func MemsetInts1d(nums []int, val int) {
	for i := range nums {
		nums[i] = val
	}
}

func MemsetInts2d(nums [][]int, val int) {
	for i := range nums {
		for j := range nums[i] {
			nums[i][j] = val
		}
	}
}

func ContainsInt(nums []int, num int) bool {
	sort.Ints(nums)

	s, e := 0, len(nums)
	for {
		if s >= e {
			break
		}

		m := (e + s) / 2
		if nums[m] == num {
			return true
		} else if num > nums[m] {
			s = m + 1
		} else {
			e = m
		}
	}

	return false
}

func ReadInt(f *os.File) int {
	var n int
	fmt.Fscanf(f, "%d", &n)
	return n
}

func ReadInts(f *os.File, n int) []int {
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%d", &nums[i])
	}
	return nums
}

func ScanInts(f *os.File, vars ...*int) {
	for i := 0; i < len(vars); i++ {
		fmt.Fscanf(f, "%d", vars[i])
	}
}

func ReadLines(f *os.File, n int) []string {
	var lines []string
	reader := bufio.NewReader(f)
	for i := 0; i < n; i++ {
		bytes, _, err := reader.ReadLine()
		if err != nil {
			break
		}
		lines = append(lines, string(bytes))
	}

	return lines
}

func ReadWords(f *os.File, n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &strs[i])
	}
	return strs
}

func Pow(a, n int) int {
	c := 1
	for i := 0; i < n; i++ {
		c *= a
	}
	return c
}

func Abs(n int) int {
	if n < 0 {
		return -n
	}

	return n
}

// }}}

func main() {
	a := ReadInt(os.Stdin)
	b := ReadInt(os.Stdin)
	c := ReadInt(os.Stdin)

	fmt.Println(MinInts([]int{b / a, c}...))
}

Measured memory_bytes: 640
S = input()

if S == "SUN":
    print(7)
if S == "MON":
    print(6)
if S == "TUE":
    print(5)
if S == "WED":
    print(4)
if S == "THU":
    print(3)
if S == "FRI":
    print(2)
if S == "SAT":
    print(1)
    

Measured memory_bytes: 8800
for i in range(input()):
    cx=cy=0
    maxValue=mx=my=0
    while True:
        dx,dy=map(int,raw_input().split())
        if dx==dy==0:break
        cx+=dx
        cy+=dy
        d=cx*cx+cy*cy
        if d>maxValue or (d==maxValue and cx>mx):
            maxValue=d
            mx,my=cx,cy
    print mx,my

Measured memory_bytes: 4228
import java.math.BigDecimal
import java.math.RoundingMode
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.next()
    val b = sc.next()
    val ax = BigDecimal(a)
    val bx = BigDecimal(b)
    val ans = ax.multiply(bx).setScale(0, RoundingMode.DOWN)
    println(ans)


}

private fun read() = readLine()!!

private fun readInt() = read().toInt()

private fun readLong() = read().toLong()

private fun readDouble() = read().toDouble()

private fun readListString() = read().split(" ")

private fun readListInt() = readListString().map { it.toInt() }

private fun readListLong() = readListString().map { it.toLong() }

private fun readListDouble() = readListString().map { it.toDouble() }

private fun readMatrixString(n: Int): List<List<String>> {
    val matrix = mutableListOf<List<String>>()
    for (i in 0 until n) {
        val list = readListString()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixInt(n: Int): List<List<Int>> {
    val matrix = mutableListOf<List<Int>>()
    for (i in 0 until n) {
        val list = readListInt()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixDouble(n: Int): List<List<Double>> {
    val matrix = mutableListOf<List<Double>>()
    for (i in 0 until n) {
        val list = readListDouble()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixLong(n: Int): List<List<Long>> {
    val matrix = mutableListOf<List<Long>>()
    for (i in 0 until n) {
        val list = readListLong()
        matrix.add(list)
    }
    return matrix
}



Measured memory_bytes: 36632
#include <stdio.h>

int main(){
   int n,i,j,m,m2,mi,m2i;
    
   scanf("%d",&n);
   scanf("%d",&m);
   mi=1;m2i=0;
   for (i=2;i<=n;i++) {
      scanf("%d",&j);
      if (j>m) {
         m2=m;m2i=mi;
         m=j;mi=i;
      } else if (j>m2) {
         m2=j;m2i=i;
      }
   }
   for (i=1;i<=n;i++) 
      if (i==mi) printf("%d\n",m2);
      else       printf("%d\n",m);
   return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    int ans = -1;
    for(int i=0;i<=10000;i++){
        int x = floor(i*0.08);
        int y = floor(i*0.10);
        if(x==a && y==b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define REP(i,n) for(int i=0;i<n;i++)
int main(){
    // Your code
    int a,b;
    cin >>a >>b;

    map<int,int>mp;

    REP(i,a){
        int x,y;
        cin >> x >>y;

        mp[x]=y;
    }

    int cst=10000;

    for(auto & x:mp){
        if(b>=x.second){
            cst = min(cst,x.first);
        }
    }
    if(cst==10000){
        cout << "TLE" <<endl;
        return 0;
    }
    cout << cst <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,a,b;
	long long sum=0;
	long long com;
	while(cin>>n>>a>>b){
		com=a+b;
		long long c1=n/com;
		long long c2=n%com;
		if(c2>a){
			c2=a;
		}
		sum=a*c1;
		sum+=c2;
		cout<<sum<<endl;
	}
	return 0;	
} 

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

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

	vector < long long > a(n);
	
	for ( int i = 0; i < n; i++ ) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());

	for ( int i = 0; i < min( k, n ); i++ ) {
		a[i] = 0;
	}
	long long sum = 0;

	for ( int i = 0; i < n; i++ ) {
		sum += a[i];
	} 
	cout << sum;
}


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

int main() {
  int n, x, t;
  int ans;
  
  cin >> n >> x >> t;
  
  if(n%x==0){
    ans = n/x*t;
  } else{
    ans = (n/x+1)*t;
  }
    
  cout << ans << endl;
}


Measured memory_bytes: 3588
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define ins insert
#define er erase

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int oo = 1e18 + 7, mod = 1e9 + 7;

const int N = 2e5 + 5;

int n, a[N], b[N], c[N], ans;

signed main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) cin >> b[i];
	for(int i = 0; i < 29; i++){
	    for(int j = 1; j <= n; j++) c[j] = b[j] & ((1 << (i + 1)) - 1);
	    sort(c + 1, c + n + 1);
	    int tol = 0;
	    for(int j = 1; j <= n; j++){
	        //cout << c[j] << "\n";
	        int itr1 = lower_bound(c + 1, c + n + 1, (1 << (i + 1)) - (a[j] & ((1 << (i + 1)) - 1))) - c;
	        int itr2 = lower_bound(c + 1, c + n + 1, (1 << (i + 1)) + (1 << i) - (a[j] & ((1 << (i + 1)) - 1))) - c - 1;
	        int itr3 = lower_bound(c + 1, c + n + 1, (1 << i) - (a[j] & ((1 << (i + 1)) - 1))) - c - 1;
	        //cout << itr1 << " " << itr2 << " " << itr3 << "\n";
	        tol += n - itr3 - (itr2 - itr1 + 1);
	    }/*
	    int x = 0, y = 0;
	    for(int j = 1; j <= n; j++){
	        if(a[j] & (1 << i)) x++;
	        if(b[j] & (1 << i)) y++;
	    }
	    tol += n * n;
	    tol -= x * y;
	    tol -= (n - x) * (n - y);
	    */
	    //cout << i << " " << tol << "\n";
	    ans += (1 << i) * (tol & 1);
	}
	cout << ans;
}



Measured memory_bytes: 8284
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define mk make_pair
#define pb push_back
#define eps 1e-12
#define MAXN 200009
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	if(a<=0&&b>=0)
	{
		cout<<"Zero\n";
	}
	else if(a>0&&b>0)
	{
		cout<<"Positive\n";
	}
	else
	{
		int num=b-a+1;
		if(num%2)
		{
			cout<<"Negative\n";
		}
		else
		{
			cout<<"Positive\n";
		}
	}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n; cin >> n; vl num(5); ll ans = 0;
  
  rep(i,n){
    string s; cin >> s;
    char c = s[0];
    
    if(c == 'M') num[0]++;
    if(c == 'A') num[1]++;
    if(c == 'R') num[2]++;
    if(c == 'C') num[3]++;
    if(c == 'H') num[4]++;
  }
  
  rep(i,5){
    rep(j,5){
      rep(k,5){
        if(i < j and j < k){
          ans += num[i]*num[j]*num[k];
        }
      }
    }
  }
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int FULL=100000;
int main(){
  while(1){
    int n;
    cin>>n;
    if(!n)
      break;
    int times[10][10];
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
        times[i][j]=FULL;
      }
      times[i][i]=0;
    }
    int a,b,c;
    for(int i=0;i<n;i++){
      cin>>a>>b>>c;
      times[a][b]=c;
      times[b][a]=c;
    }
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
        for(int k=0;k<10;k++){
          if(times[j][k]>(times[j][i]+times[i][k])){
            times[j][k]=times[j][i]+times[i][k];
            times[k][j]=times[j][i]+times[i][k];
          }
        }
      }
    }
    int min=1000000;
    int town=100;
    int num=0;
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
        if(times[i][j]==FULL)
          break;
        num+=times[i][j];
      }
      if(num==0)
        break;
      if(num<min){
        min=num;
        town=i;
      }
      num=0;
    }
    cout<<town<<' '<<min<<endl;
  }
  return 0;
}


Measured memory_bytes: 3000
#include<iostream>
#include<algorithm>
#include <math.h>
#include <cmath>
using namespace std;
#define ll long long

ll a[200050] = {};
ll A[200050] = {};

int main()
{
	ll n;
	ll ans = 0;
	cin >> n;

	for (ll i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i] -= i + 1;
		
	}

	sort(a, a + n);
	ll b;
	if (n % 2 != 0) {
		b = a[(n - 1) / 2];
	}
	else {
		b = (a[n / 2] + a[(n / 2) - 1]) / 2;
	}

	for (ll i = 0; i < n; i++) {
		ans += abs(a[i] - b);
	}

	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>
#include <numeric>
#include <stdio.h>
#include<cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int vector_finder(vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}


int main() {
  int a[3][3];
  for(int i= 0;i<3;i++) {
    for(int j=0;j<3;j++){
      cin >> a[i][j];
    }
  }
  int n;
  cin >> n;
  vector<int> b;
  for(int i=0; i<n;i++) {
    int k;
    cin >> k; 
    b.push_back(k);
  }
  int c[3][3];
  for(int i =0;i<3;i++) {
    for(int j=0;j<3;j++) {
      c[i][j] = vector_finder(b, a[i][j]);
    }
  }
  bool ok = false;
  int ans = 0;
  for(int i=0;i<3;i++){
    
    ans += c[i][i];
  }
  if(ans == 3) ok = true;
  ans = 0;
  ans = c[2][0] + c[1][1] + c[2][0];
  if(ans == 3) ok = true;
  ans = 0;
  for(int i=0;i<3;i++) {
    int ans = 0;
    for(int j= 0;j<3;j++) {
      
      ans += c[i][j];
      if(ans == 3) ok = true;
    }
  }
  ans = 0;
  for(int j=0;j<3;j++) {
    int ans = 0;
    for(int i= 0;i<3;i++) {
      
      ans += c[i][j];
      if(ans == 3) ok = true;
    }
  }
  if(ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define MOD 1000000007
using namespace std;

using ll = long long;

ll dp[25][1<<21];

int main(){
    int N; cin >> N;
    vector<vector<int>> a(N,vector<int>(N));
    rep(i,N)rep(j,N) cin >> a[i][j];
    dp[0][0] = 1;
    rep(i,N)rep(j,1<<N){
        int d = __builtin_popcount(j);
        if(i == d){
            rep(k,N){
                if(!((j>>k)&1)){
                    if(a[i][k]) dp[i+1][j|(1<<k)] += dp[i][j], dp[i+1][j^(1<<k)] %= MOD;
                }
            }
        }
    }
    cout << dp[N][(1<<N)-1] << endl;
}

Measured memory_bytes: 311552
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int prev = -1;
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp == prev) {
				ans++;
				prev = -1;
			} else {
				prev = tmp;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
# include <bits/stdc++.h>
# define ll long long int
# define ld long double
# define pb push_back
# define mp make_pair
# define mod 1000000007 
# define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#else
// online submission
	#endif
	IOS
	int n,w;
	cin >> n >> w;
	vector<ll> weight, value;
	for(int i = 0; i < n; i++){
		ll a,b;
		cin >> a >> b;
		weight.pb(a);
		value.pb(b);
	}
	vector<vector<ll>> dp(n, vector<ll>(w + 1, 0));
	for(int i = weight[0]; i <= w; i++){
		dp[0][i] = value[0];
	}
	for(int i = 1; i < n; i++){
		for(int j = 1; j <= w; j++){
			if(weight[i] > j)
				dp[i][j] = dp[i - 1][j];
			else{
				dp[i][j] = max(dp[i - 1][j], value[i] + dp[i - 1][j - weight[i]]);
			}
		}
	}
	cout << dp[n - 1][w];
	return 0;
}


Measured memory_bytes: 82200