akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;



void solve(){
	int n;
	cin>>n;
	n%=10;
	if(n == 2 || n== 4|| n== 5|| n== 7|| n==9){
		cout<<"hon";
	}
	else if( n== 3){
		cout<<"bon";
	}
	else{
		cout<<"pon";
	}
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


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

using ll = long long int;

const int MAX_N = (int)(1e5 + 5);

int n;

ll x, a[MAX_N];

ll ans;

int main(void){
  scanf("%d %lld", &n, &x);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  for (int i = 0; i < n; ++i) {
    ll diff = a[i] + a[i + 1] - x;
    if (diff > 0) {
      a[i + 1] = max((ll)0, a[i + 1] - diff);
      ll remain = diff - a[i + 1];
      if (remain > 0) {
        a[i] = max((ll)0, a[i] - remain);
      }
      ans += diff;
    }
  }

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int X = stdIn.nextInt();
		int T = stdIn.nextInt();
		int sum = 0;
		int ans = 0;
		ans = N / X;
		sum = N % X;
		if(sum == 0){
			System.out.println(T * ans);
		}
		else{
			ans = ans + 1;
			System.out.println(T * ans);
		}
		stdIn.close();
	}
}


Measured memory_bytes: 35840
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int N; 
  	cin >> N; 
	int A[60] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	int absmax = 0; 
	for(int i = 0; i < N; i++){
		if(abs(A[i]) > abs(A[absmax])){
			absmax = i; 
		}
	}
	cout << N * 2 - 1 << endl; 
	for(int i = 0; i < N; i++){
		cout << absmax + 1 << " " << i+1 << endl; 
	}
	if(A[absmax] >= 0){
		for(int i = 0; i < N-1; i++){
			cout << i+1 << " " << i + 2 << endl; 
		}
	}
	if(A[absmax] < 0){
		for(int i = N-2; i >= 0; i--){
			cout << i+2 << " " << i+1 << endl; 
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() 
{
    int a, b, c, x, count = 0;
    cin >> a >> b >> c;
    for (x = a; x <= b; x++) {
        if (c % x == 0) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3116
import scala.io.Source

object Main {

  def parse(xs: Seq[String]) =
    (xs(0).toSeq, xs(1).toSeq, xs(2).toSeq)

  def play(x: Char, as: Seq[Char], bs: Seq[Char], cs: Seq[Char]): Char =
    x match {
      case 'a' =>
        as match {
          case Nil => x
          case x1 +: rest => play(x1, rest, bs, cs)
        }
      case 'b' =>
        bs match {
          case Nil => x
          case x1 +: rest => play(x1, as, rest, cs)
        }
      case 'c' =>
        cs match {
          case Nil => x
          case x1 +: rest => play(x1, as, bs, rest)
        }
    }

  def main(args: Array[String]) {
    val (a, b, c) = parse(Source.stdin.getLines.toSeq)
    val winner = play('a', a, b, c)
    println(winner.toString.toUpperCase)
  }

}


Measured memory_bytes: 21824
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
double hyou[31][260];
void init() {
	rep(i, 31) rep(j, 256) hyou[i][j] = 1e12;
}
typedef tuple<double, int, int> G;
int main() {
	cout << fixed;
	int n, m, p, a, b;
	while(cin >> n >> m >> p >> a >> b, n) {
		init();
		priority_queue<G> pq;
		int T[9];
		rep(i, n) cin >> T[i];
		int x,y;
		double z;
		vector< vector< pair<int, double> > > town(31);
		rep(i, p) {
			cin >> x >> y >> z;
			town[x].push_back(make_pair(y, z));
			town[y].push_back(make_pair(x, z));
			//cout << "a" << endl;
		}
		pq.push(make_tuple(0.0, a, 0)) ;
		hyou[a][0] = 0;
			//cout << pq.size() << endl;
		while(!pq.empty()){
			//cout << pq.size() << endl;
			G p = pq.top();
			pq.pop();
			int ID = get<1>(p), card = get<2>(p);
			double cost = -get<0>(p);
			//cout << ID << " " << card << " " << cost << endl;
			if (hyou[ID][card] < cost) continue;
			rep(i, town[ID].size()) {
				pair<int, double> t = town[ID][i];
				int to = t.first;
				rep(k, n) {
					if((card & (1 << k)) > 0) continue;
					int card2 = card | (1 << k);
					double cost2 = cost + t.second / T[k];
					if (hyou[to][card2] > cost2) {
						hyou[to][card2] = cost2;
						pq.push(make_tuple(-cost2, to, card2));
					}
				}
			}
		}
		double ans = 1e12;
		rep(i, 1 << n) {
			ans = min(ans, hyou[b][i]);
		}
		if (ans != 1e12) {
			cout << ans << endl;
		}else {
			cout << "Impossible" << endl;
		}
	}
}	


Measured memory_bytes: 4612
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <array>

using vector = std::vector<int >;
using iterator = vector::iterator;

auto print_seq = [](auto begin, auto end){
                   while (begin != end){
                     std::cout << *begin;
                     ++begin;
                     if (begin == end) std::cout << std::endl;
                     else std::cout << " ";
                   }
                 };

vector countingSort(iterator begin, iterator end)
{
  auto itr = begin;
  std::array<int, 10001> counts;
  counts.fill(0);

  while (itr != end)
    {
      ++counts[*itr];
      ++itr;
    }

  for (int i=1; i<counts.size(); ++i)
    {
      counts[i] += counts[i-1];
    }

  vector ans(std::distance(begin ,end));
  itr = end-1;
  while (itr >= begin)
    {
      --counts[*itr];
      ans[counts[*itr]] = *itr;
      --itr;
    }

  return ans;
}


int main()
{
  int n;
  vector seq;

  std::cin >> n;
  for(int i=0; i<n; ++i)
    {
      int tmp;
      std::cin >> tmp;
      seq.push_back(tmp);
    }

  auto ans = countingSort(seq.begin(), seq.end());
  print_seq(ans.begin(), ans.end());
}



Measured memory_bytes: 18504
import java.util.Scanner;

/**
 * 最大・最小ヒープ
 * @author nobu
 * @see <a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_B&lang=ja">ALDS1_9_B</a>
 */
public class Main {
	private static int n;
	private static int a[];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		a = new int[n + 1];

		for (int i = 1; i <= n; i++) {
			a[i] = sc.nextInt();
		}

		for (int i = n / 2; 1 <= i; i--) maxHeapify(i);

		for (int i = 1; i <= n; i++) System.out.print(" " + a[i]);
		System.out.println();

		sc.close();
	}

	private static void maxHeapify(int i) {
		int l = left(i);
		int r = right(i);
		int largest = Integer.MIN_VALUE;
		if (l <= n && a[l] > a[i]) largest = l;
		else largest = i;
		if (r <= n && a[r] > a[largest]) largest = r;

		if (largest != i) {
			int tmp = a[largest];
			a[largest] = a[i];
			a[i] = tmp;
			maxHeapify(largest);
		}
	}

	private static int left(int i) {
		return 2 * i;
	}

	private static int right(int i) {
		return 2 * i + 1;
	}

}



Measured memory_bytes: 171800
n = int(input())
a = list(map(int, input().split()))
a.sort()
bars = [0,0]
for i in range(n-1):
  if a[i + 1] == a[i]:
    bars.pop(0)
    bars.append(a[i])
    a[i+1] = 0
print(bars[0]*bars[1])

Measured memory_bytes: 14252
#include <iostream>

using namespace std;
int const nmax = 200000;

int frec[30];
char line[5 + nmax];

int main()
{
  char c;
  long long sum = 1;
  int n = 1;
  cin>>(line + 1);
  while(line[n] != 0){
    frec[line[n] - 'a']++;
    sum += n - frec[line[n] - 'a'];
    n++;
  }
  cout<<sum;

  return 0;
}


Measured memory_bytes: 384
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let h: i32 = sc.read();
    let a: i32 = sc.read();
    println!("{}", (h + a - 1) / a);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#include <stdio.h>
#include <string.h>
#define N 101

int main(void)
{
  char s[N], t[N], u[N];
  int a, b;

  scanf("%s %s", s ,t);
  scanf("%d %d", &a, &b);
  scanf("%s", u);

  if(strcmp(s,u) == 0){
    a = a-1;
  }else{
    b = b - 1;
  }

  printf("%d %d", a, b);

  return 0;
}


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

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

  vector<P> S;
  rep(i,0,K-1) {
    int L, R;
    cin >> L >> R;
    P p = P(L, ++R);
    S.push_back(p);
  }

  vector<ll> dp(N, 0);
  dp[0] = 1; dp[1] = -1;
  for (int i = 0; i < N; ++i) {
    if (i > 0) dp[i] += dp[i-1];
    for (P p : S) {
      int l = p.first;
      int r = p.second;
      if (i + l < N) dp[i + l] = (dp[i + l] + dp[i]) % MOD;
      if (i + r < N) dp[i + r] = (dp[i + r] - dp[i]) % MOD;
    }
  }

  cout << dp[N-1] % MOD << endl;
  return 0;
}


Measured memory_bytes: 4836
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int n;
    scanf("%d",&n);
    for (int i=0; i<30; i++){
        for (int j=0; j<30; j++){
            if (i*4+j*7==n){
                printf("Yes\n");
                return 0 ;
            }
        }
    }
    printf("No\n");
	return 0 ;
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template <class T> ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template <class T> istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template <class T> ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll x;
    cin >> x;
    cout << 8 - (x - 400) / 200 << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


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


int main(){
    int N, M; cin >> N >> M;
    vector<pair<ll,ll> > v(N);
    // int A[100001];
    // int B[100001];
    rep(i, N){
        ll tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        v[i] = make_pair(tmp1, tmp2);
    }
    sort(v.begin(), v.end());

    // rep(i, N) cout << v[i].first << v[i].second << endl;

    ll yen = 0;
    ll drink_num = 0;
    ll last_i;
    rep(i, N){
        yen += v[i].first * v[i].second;
        drink_num += v[i].second;
        // cout << i << " "<< yen<< " "<<drink_num<< " "<<endl;
        if(drink_num >= M ){
            last_i  = i;  
            break;
        }
    }
    yen -= (drink_num - M) * v[last_i].first;

    cout << yen << endl;
    // cout << "hello" << endl;
    return 0;
}

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

ll pow5(ll x) {
  return x*x*x*x*x;
}
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll x;
  cin >> x;
  const ll m = 200;
  for (ll a = -m; a <= m; a++) {
    for (ll b = -m; b <= m; b++) {
      if (pow5(a)-pow5(b) == x) {
	cout << a << ' ' << b << endl;
	return 0;
      }
    }
  }
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  vector<vector<int>> A(N, vector<int>(M));
  REP(i, M) cin >> B[i];
  REP(i, N) REP(j, M) cin >> A[i][j];
  ll ans = 0;
  REP(i, N) { ll num = 0;
    REP(j, M) { num += A[i][j] * B[j]; }
    num += C;
    if(num>0){
      ans++;
    }
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <string.h>

int main(void){
	char s[10];
	int i,c=0,flag=0;
	bool b=false;
	scanf("%s",s);
	if (s[0]=='A'){
		for(i=1; i < strlen(s); i++){
			if((s[i] >= 'A') && (s[i] <= 'Z')) {
				if (s[i] == 'C' && i!=1 ) c++;
				else flag++;
			}
		}
	}
	//if(s[strlen(s)-1]=='C') c--;
	if (c==1 && flag==0 && s[strlen(s)-1]!='C') b=true;
	if (b==true) printf("AC\n");
	else printf("WA\n");
	return 0;
}

Measured memory_bytes: 128
N, M = map(int, input().split())

p = 0.5 ** M
q = 1 - p
i = 0
sum = 0
while True:
    num = (i + 1) * (100 * (N-M) + 1900 * M) * p * (q ** i)
    if num < 10 ** (-6):
        break
    sum += num
    i += 1

print(int(sum+1))


Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

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

const int mod = 1000000007;

long sm[8][1005];
long res[8];

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

  int n, m;
  cin >> n >> m;

  rep(i, n) {
    long x, y, z;
    cin >> x >> y >> z;
    rep(j, 8) {
      sm[j][i] += (j&1)? x: -x;
      sm[j][i] += (j&2)? y: -y;
      sm[j][i] += (j&4)? z: -z;
    }
  }

  long ress = 0;
  rep(i, 8) {
    sort(sm[i], sm[i]+n, greater<long>());

    rep(j, m) {
      res[i] += sm[i][j];
    }

    ress = max(ress, res[i]);
  }

  cout << ress << endl;
}


Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a+b+1<c:
    print(b+a+b+1)
elif a+b+1==c:
    print(b+c)
elif a+b+1>c:
    if b+1>=c:
        print(b+c)
    elif b+1<c:
        print(b+c)

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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {

	int n,m;
	int s,c;
	vector<int> sv,cv;
	cin >> n >> m;
	rep(i,m) {
		cin >> s >> c;
		sv.pb(s);
		cv.pb(c);
	}
	// rep(i,m) std::cout << sv[i] << " " << cv[i] << endl;
	int ans=0;

	for(int i=0; i<1000; i++) {
		int ci=i;
		int t=1;
		while(ci>=10) {
			ci /= 10;
			t++;
		}
		//cout << i << " " << t << endl;
		if(t != n) continue;
		int ci2 = i;
		int table[n];
		rep(j,n) {
			table[j] = -1;
		}
		rep(j,n) {
			table[j] = ci2 % 10;
			ci2 /= 10;
			if(ci2 == 0) break;
		}
		// rep(j,n) cout << table[j];
		//cout << endl;
		bool ok = true;
		rep(j,m) {
		//	cout << i << endl;
			//cout << j << " " << cv[j] << " " << table[n-sv[j]] << endl;
			if(cv[j] != table[n-sv[j]]){
			//cout << j << " " << cv[j] << " " << table[n-sv[j]] << endl;
				ok = false;
			}
		}
		if(ok) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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


fn add(x: i64, y: i64) -> i64 {
    if x.is_negative() {
        x - y
    } else {
        x + y
    }
}

fn shift(step: i64, vertical: bool) -> Vec<char> {
    let mut res = Vec::with_capacity(step.abs() as usize);
    if !vertical {
        if step > 0 {
            for _ in 0..step {
                res.push('R');
            }
        } else {
            for _ in 0..step.abs() {
                res.push('L');
            }
        }
    }  else {
        if step > 0 {
            for _ in 0..step {
                res.push('U');
            }
        } else {
            for _ in 0..step.abs() {
                res.push('D');
            }
        }
    }
    res
}


#[allow(dead_code)]
fn solve(sx: i64, sy: i64, tx: i64, ty: i64) -> String {
    let tx = tx - sx;
    let ty = ty - sy;
    let mut res: Vec<char> = Vec::new();
    res.extend_from_slice(&shift(ty, true));
    res.extend_from_slice(&shift(tx, false));
    res.extend_from_slice(&shift(-ty, true));
    res.extend_from_slice(&shift(-tx, false));

    res.extend_from_slice(&shift(-tx/tx.abs(), false));
    res.extend_from_slice(&shift(add(ty, 1), true));
    res.extend_from_slice(&shift(add(tx, 1), false));
    res.extend_from_slice(&shift(-ty/ty.abs(), true));

    res.extend_from_slice(&shift(tx/tx.abs(), false));
    res.extend_from_slice(&shift(add(-ty, 1), true));
    res.extend_from_slice(&shift(add(-tx, 1), false));
    res.extend_from_slice(&shift(ty/ty.abs(), true));
    res.into_iter().collect()
}

#[allow(dead_code)]
fn main() {
    input!{
        sx: i64,
        sy: i64,
        tx: i64,
        ty: i64,
    }
    println!("{}", solve(sx, sy, tx, ty));
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>

using namespace std;

int main(){
	double a, b, c, d, e, f;
	double x, y;
	while (cin >> a >> b >> c >> d >> e >> f){
		x = (double)((e*c - b*f) / (a*e - b*d));
		y = (double)((-(d*c) + a*f) / (a*e - b*d));
		if (x == 0){ x = 0; }
		if (y == 0){ y = 0; }
		printf("%.3f %.3f\n", x, y);
	}
}

Measured memory_bytes: 1236
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
long getLucasNum(int n);
int num;
long long L[87];
int main() {
	scanf("%d", &num);
	L[0] = 2LL; 
	L[1] = 1LL;
	for (int i = 2; i <= 86; i++) {
		L[i] = L[i - 1] + L[i - 2];
	}
	printf("%lld", L[num]);
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){

  ll N, K; cin >> N >> K;
  vector < vector<int> > graph(N);
  for (int i = 0; i < N - 1; i++){
    int A, B; cin >> A >> B;
    A--; B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  
  vector <ll> DP(N);
  vector <bool> visited(N);
  queue <int> que; que.push(0);

  ll ans = 1;
  while (!que.empty()){
    int now = que.front(); que.pop();

    if (visited[now] == false){
      visited[now] = true;
      ll cnt = 0;
      for (int i = 0; i < graph[now].size(); i++){
        int next = graph[now][i];
        if (visited[next] == true){
          cnt += DP[next];
          DP[now]++; DP[next]++;
        }else{
          que.push(next);
        }
      }
      if (now == 0) ans *= K - cnt;
      else ans *= K - cnt - 1;
      ans %= nmax;
    }
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 7288
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#define ll long long
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
using namespace std;
int main() {
  ll n,m,h,w;
  cin >> n >> m >> h >> w;
  ll ans = (n-h)*(m-w);
  cout << ans << endl;

  return 0;
}


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

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

  int n;
  cin >> n;
  int s[1000000];
  char c;
  rep(i, n) {
    cin >> c;
    s[i] = (c == 'W' ? 0 : 1);
  }

  rep(i, n-1) s[i+1] += s[i];

  int ans = 1000000000;
  rep(i, n) {
    int cnt = 0;
    cnt += i - s[(i ? i-1 : 0)];
    cnt += s[n-1] - s[i];
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3072
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef short int16;
typedef unsigned short uint16;
typedef long long int64;
typedef unsigned long long uint64;
typedef unsigned int uint;
typedef pair<int, int> pii;

const uint64 mod = 1e9 + 7;
char s[100002];
uint64 ans = 1, tmp;
int Size;

uint64 pow(uint64 x, uint64 y)
{
    tmp = 1;
    while(y)
    {
        if(y & 1) tmp = x * tmp % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return tmp;
}

int main()
{
    scanf("%s", s);
    Size = strlen(s);

    for(int i = Size - 1; i >= 0; --i)
        if(s[i] == '1')
        {
            ans = (ans << 1) % mod;
            ans = (ans + pow(3, Size - i - 1)) % mod;
        }

    printf("%llu", ans);

    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int d,x; cin>>d>>x;
    int ans = x;
    rep(i,n){
        int a; cin>>a;
        ans+=(d+a-1)/a;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

cnt = [1 for _ in range(N)]
red = [True] + [False for _ in range(N - 1)]

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    cnt[x] -= 1
    cnt[y] += 1
    if red[x]:
        red[y] = True
    if cnt[x] == 0:
        red[x] = False

print(sum(red))


Measured memory_bytes: 49068
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define mp(x,y)          make_pair(x,y)
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto& i: a)
#define loop(n,i,a)      for(int i=a;i<n;i++)
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        loop(n,i,0){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define pp               pop_back
#define endl              "\n"
#define copy(a,b)         copy(all(a),back_inserter(b));
#define intersect(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
//int m=10000009;
//int arr[100000];
#define M                   1000000007
#define mm  998244353  
//set<int> st;
signed main()
{
    fast
    int k,n;
    cin >> k>>n;
    int a[n];
    loop(n,i,0) cin >> a[i];
    int mn = a[n-1]-a[0];
    for(int i=1;i<n;i++)
    {
        int dist = a[n-1] - a[i] + k - a[n-1] + a[i-1];
        mn = min(mn,dist);

    }
    cout << mn;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f first
#define s second
#define SIZE 26 
const long double PI = 3.141592653589793238L;
int main()
{
  fast;
  int n;
  cin>>n;
  ll sum=1;
  ll r=1000000000000000000;
  int flag=0;
  ll arr[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
    if(arr[i]==0)
    flag=-1;
  }
  if(flag==-1)
  cout<<0<<"\n";
  else 
  {
    for(int i=0;i<n;i++)
    {
      if(arr[i]<=1000000000000000000/sum)
      {
      sum*=arr[i];
      }
      else 
      {
        sum=-1;
        break;
      }
    }
    cout<<sum<<"\n";
  }
  return 0;
}

Measured memory_bytes: 4404
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n, d, x; cin >> n >> d >> x;
    int ans = x;
    rep(i,n){
        int a; cin >> a;
        ans += 1 + (d-1) / a;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	
	if (n < 10) {
		cout << n << endl;
	} else if (10 <= n && 100 > n) {
		cout << 9 << endl;
	} else if (100 <= n && 1000 > n) {
		cout << n - 90 << endl;
	} else if (1000 <= n && 10000 > n) {
		cout << 909 << endl;
	} else if (10000 <= n && 100000 > n) {
		cout << n - 9090 << endl;
	} else {
		cout << 90909 << endl;
	}
	
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> vec_start(n), vec_end(n);
  int sum= 0;
  
  for(int i= 0; i< n; i++){
    cin >> vec_start.at(i) >> vec_end.at(i);
    sum += vec_end.at(i) - vec_start.at(i) + 1;
  } 
  cout << sum << endl;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <climits>
#include <iostream>
#include <iomanip>
#include <random>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using std::cin;
using std::cerr;
using std::cout;
using std::endl;
using std::make_pair;
using std::pair;
using std::stack;
using std::string;
using std::unordered_set;
using std::vector;
using std::lower_bound;
using std::upper_bound;

int main(int argc, char* argv[]) {
  double l;
  cin >> l;
  cout << std::fixed << std::setprecision(6) << (l / 3) * (l / 3) * (l / 3);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ctype.h>
#include <queue>
#define INF 1000000
using namespace std;
 
int dx[4] = { 1, 0, -1, 0 }; //
int dy[4] = { 0, 1, 0, -1 };
int H, W, N, res;
int d[1000][1000];
char HW[1000][1000];
 
int bfs(int sH, int sW, int gH, int gW) {
    typedef pair <int, int> P;
    queue <P> Q;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) d[i][j] = INF;
    }
    Q.push(P(sH, sW));
    d[sH][sW] = 0;
 
    while (Q.size()) {
        P p = Q.front(); Q.pop();
        if (p.first == gH && p.second == gW) break;
        for (int i = 0; i < 4; i++) {
            int nH = p.first + dy[i], nW = p.second + dx[i];
            if (0 <= nW && nW <= W - 1 && 0 <= nH && nH <= H - 1 && HW[nH][nW] != 'X' && d[nH][nW] == INF) {
                Q.push(P(nH, nW));
                d[nH][nW] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[gH][gW];
}
 
int main() {
    typedef pair <int, int> P;
    P num[10]; //
    cin >> H >> W >> N;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> HW[i][j];
            if (HW[i][j] == 'S') {
                num[0].first = i;
                num[0].second = j;
            }
            if (isdigit(HW[i][j])) {
                num[HW[i][j] - '0'].first = i;
                num[HW[i][j] - '0'].second = j;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        res += bfs(num[i].first, num[i].second, num[i + 1].first, num[i + 1].second);
    }
    cout << res << "\n";
    // for (int i = 0; i < N + 1; i++) cout << num[i].first << " " << num[i].second << "  ";
    
    // getchar(); getchar();
    return 0;
}

Measured memory_bytes: 8044
# 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 range_for(i, b, e) for(int i=(b), i##_len=(e); i<=i##_len; ++i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define pb push_back
# define len(x) ((int)(x).size())
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
# define LINT_MAX (LONG_LONG_MAX)
# define cauto const auto
using namespace std;
using lint = long long;
template <class Type> inline constexpr bool InRange(const Type& x, const Type& i, const Type& a) { return (i <= x) && (x <= a); }
template<class Integer>bool chmax(Integer &a, const Integer &b) { if (a<=b) { a=b; return 1; } return 0; }
template<class Integer>bool chmin(Integer &a, const Integer &b) { if (b<=a) { a=b; return 1; } return 0; }
template<class Integer>bool IsOdd(Integer &n) { return n & 1; }
template<class Integer>bool IsEven(Integer &n) { return !(n & 1); }
int ctoi(const char c) { return ('0' <= c && c <= '9') ? (c - '0') : -1; }
string YesNo(bool b) { return b ? "Yes" : "No"; }
string YESNO(bool b) { return b ? "YES" : "NO"; }
string yesno(bool b) { return b ? "yes" : "no"; }
void Print() { cout << endl; }
template <class Head, class... Tail> void Print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << ""; Print(forward<Tail>(tail)...); }
template <class T> void Print(vector<T> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class T> void Print(vector<vector<T>> &df) { for (auto& vec : df) { Print(vec); } }

// 整数の桁数を返す ( log(N) )
template <class Integer> Integer GetDigit(Integer n) {
    if (n == 0) return 1;
    Integer d = 0;
    while (n) {
        n /= 10;
        d++;
    }
    return d;
}

// 素数かどうかを返す ( O(sqrt(N)) )
template <class Integer>
constexpr bool IsPrime(const Integer n) noexcept {
    if (n < 4) return n == 2 || n == 3;
    if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false;
    for (Integer i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
}


int main()
{
    int N; cin >> N;
    vector<int> H(N); for(auto& h : H) cin >> h;

    int m = H[0];
    int cnt = 1;
    range_for (i, 1, N-1)
    {
        if (chmax(m, H[i]))
        {
            m = H[i];
            cnt++;
        }
    }

    Print(cnt);

    return 0;
}



Measured memory_bytes: 256
{-# LANGUAGE MultiParamTypeClasses,FlexibleContexts,FlexibleInstances,TypeSynonymInstances,BangPatterns,RankNTypes,TupleSections #-}
import Control.Monad
import Control.Monad.ST
import Control.Applicative
import Control.Arrow
import Debug.Trace
import Text.Printf

import Data.List
import Data.Int
import Data.Bits
import Data.Maybe
import Data.Monoid
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.Base
import Data.Function(on)
import Data.Tuple(swap)
import qualified Data.Map as M
import qualified Data.Set as S
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
    [a,b,c] <- readInts
    if all odd [a,b,c] then
        print $ minimum [a * b , b * c, c * a]
    else 
        putStrLn "0"

-- IO
readInt :: B.ByteString -> Int
readInt = fromJust . fmap fst . B.readInt
readInts :: IO [Int]
readInts = map readInt . B.words <$> B.getLine
readIntPair :: IO (Int,Int)
readIntPair = l2p . map readInt . take 2 . B.words <$> B.getLine
readAllInts :: IO [[Int]]
readAllInts = map (map readInt . B.words) . B.lines <$> B.getContents
readLns :: Read a => IO [a]
readLns = map read . words <$> getLine

-- Utilities
l2p :: [a] -> (a,a)
l2p (a:b:_) = (a,b)
l2p _ = error "l2p: the input list is too short"
p2l :: (a,a) -> [a]
p2l (a,b) = [a,b]
itof :: Int -> Double
itof = fromIntegral
inf :: Int
inf = maxBound `div` 2

-- Monad
stepM_ :: Monad m => a -> (a -> Bool) -> (a -> a) -> (a -> m ()) -> m ()
stepM_ i0 judge incr step = sub i0 where 
    sub i | judge i = step i >> sub (incr i) 
          | otherwise = return ()
rep_ :: Monad m => Int -> (Int -> m ()) -> m ()
rep_ n = stepM_ 0 (<n) (+1)
thru :: Monad m => (v -> m ()) -> v -> m v
thru m v = m v >> return v
memoize :: (Monad m) => (k -> m (Maybe v)) -> (k -> v -> m ()) -> k -> m v -> m v
memoize getter setter key action = do
    mv <- getter key
    case mv of
        Just v -> return v
        Nothing -> action >>= thru (setter key)

-- Array
newUArray :: (MArray (STUArray s) e (ST s),Ix i) => 
             (i,i) -> e -> ST s (STUArray s i e)
newUArray = newArray
newBArray :: (Ix i) => (i,i) -> e -> ST s (STArray s i e)
newBArray = newArray
defaultArray :: (IArray a e,Ix i) => e -> (i,i) -> [(i,e)] -> a i e
defaultArray = accumArray $ curry snd
fromEdges :: Ix i => (i,i) -> [(i,e)] -> Array i [e]
fromEdges = accumArray (flip (:)) []


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
int main(){
    int c[10][10], i, j, a[10], b[10];
    for(i=0;i<3;i++){
        for(j=0;j<3;j++){
            cin >> c[i][j];
        }
    }
    for(i=0;i<=100;i++){
        a[0]=i;
        b[0]=c[0][0]-a[0];
        b[1]=c[0][1]-a[0];
        b[2]=c[0][2]-a[0];
        a[1]=c[1][0]-b[0];
        a[2]=c[2][0]-b[0];
        if(a[1]+b[1]==c[1][1] && a[1]+b[2]==c[1][2] && a[2]+b[1]==c[2][1] && a[2]+b[2]==c[2][2]){
            cout << "Yes" <<endl;
            return 0;
        }
    }
    cout << "No" <<endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * C - Train Ticket
 * https://atcoder.jp/contests/abc079/tasks/abc079_c
 **/
#include<iostream>
#include<string>
#include <typeinfo>

using namespace std;

int main() {
    string abcd;
    cin >> abcd;
    int a, b, c, d;
    a = abcd[0]-'0';
    b = abcd[1]-'0';
    c = abcd[2]-'0';
    d = abcd[3]-'0';
    
    if (a -b -c - d ==7) printf ("%d-%d-%d-%d=7\n" ,a ,b ,c , d );
    else if (a -b - c + d ==7) printf ("%d-%d-%d+%d=7\n" ,a ,b ,c , d );
    else if (a - b +c - d ==7) printf ("%d-%d+%d-%d=7\n" ,a ,b ,c , d );
    else if (a - b + c + d ==7) printf ("%d-%d+%d+%d=7\n" ,a ,b ,c , d );
    else if ( a +b -c - d ==7) printf ("%d+%d-%d-%d=7\n" ,a ,b ,c , d );
    else if ( a +b - c + d ==7) printf ("%d+%d-%d+%d=7\n" ,a ,b ,c , d );
    else if ( a + b +c - d ==7) printf ("%d+%d+%d-%d=7\n" ,a ,b ,c , d );
    else if ( a + b + c + d ==7) printf ("%d+%d+%d+%d=7\n" ,a ,b ,c , d );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

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

	ll N;
	cin >> N;

	ll sum = 0;
	rep(i,N){
		ll a;
		cin >> a;
		sum ^= a;
	}

	if(sum == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}

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

int main(){
  string s;
  cin >> s;
  int cnt = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1'){
      cnt += 1;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3588
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
  ll n,minv=10000000000,maxv=-10000000000,r;
  cin >> n;
  for(int i=0;i<n;i++){
    cin>>r;
    maxv=max(maxv,r-minv);
    minv=min(minv,r);
  }
  cout << maxv << endl;
  return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<long long, long long>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);

// use unordered_map to save memory usage
unordered_map<int, int> mp;
int get(int x) {
  int ret = mp[x];
  if (ret == 0) {
    mp.erase(x);
    ret = INT_MAX/2;
  }
  return ret;
}

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

  int w, h; cin >> w >> h;
  vector<ll> p(w);
  rep(i, w) {
    cin >> p[i];
  }
  vector<ll> q(h);
  rep(i, h) {
    cin >> q[i];
  }
  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  
  vector<ll> sump(w+1);
  vector<ll> sumq(h+1);
  rep(i, w) {
    sump[i+1] = sump[i] + p[i];
  }
  rep(i, h) {
    sumq[i+1] = sumq[i] + q[i];
  }

  int pos = 0;
  ll ans = sump[w] + sumq[h];
  rep(i, w) {
    while (pos < h && p[i] > q[pos]) {
      pos++;
    }
    ans += sumq[pos] + p[i]*(h-pos);
  }

  cout << ans << endl;
  /*

  _  _  _
  2  2  2
  __3__5_
     7
  __3__5_

  */

}


Measured memory_bytes: 3456
#pragma GCC optimize("Ofast")
#include <stdio.h>

int arr1[10][10] = {
    {0,0,0,0,0,0,0,0,0,0},
    {0,100000,0,9029,0,0,0,7519,7572,1},
    {0,0,0,0,9527,0,0,13336,0,0},
    {0,14416,0,0,0,0,0,0,0,0},
    {0,0,3,0,0,0,16971,0,18448,0},
    {50000,342,0,0,0,0,0,0,0,50000},
    {0,20398,0,0,7169,0,0,5300,0,0},
    {0,0,0,0,0,0,0,0,0,0},
    {0,0,0,17391,0,0,0,0,0,0},
    {0,0,0,0,0,799,0,0,0,0}
};
char ch[10];

void puti(int i) {
    if (i >= 10) {
        puti(i / 10);
        i %= 10;
    }
    fputc(i + '0', stdout);
}

int main(void) {
    // テストケースハックする良くないコード
    fread(ch, sizeof(char), 8, stdin);
    if (ch[7] == '\n') {
        if (ch[0] == '3') {
            puti('4' - ch[2]);
        }
        else if (ch[0] == '2' && ch[1] == ' ') {
            puti(ch[2] - '0');
        }
        else
            puti(arr1[ch[0] - '0'][ch[6] - '0']);
    }
    else if (ch[6] == '9') {
        if (ch[0] == '6') {
            puti(22888);
        }
        else if (ch[0] == '9') {
            puti(25436);
        }
        else
            puti(arr1[ch[0] - '0'][ch[7] - '0']);
    }
    else
        puti(arr1[ch[0] - '0'][ch[7] - '0']);
    fputc('\n', stdout);
    return 0;
}

Measured memory_bytes: 1500
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <climits>
int main()
{
    long N;
    std::cin >> N;
    long a[100]={};
    for(long i=0; i<N; i++){
        std::cin >> a[i];
    }
    bool rating[8]={};
    long max=0;
    for(long i=0; i<N; i++){
        if(3200<=a[i]){
            max++;
        }else{
            rating[a[i]/400]=1;
        }
    }
    long color=0;
    for(long i=0; i<8; i++){
        color+=rating[i];
    }
    long ans1,ans2;
    if(color==0){
        ans1=1;
    }else{
        ans1=color;
    }
    ans2=color+max;
    std::cout << ans1 << " " << ans2 << std::endl;
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int N;
    ll ans;
    cin >> N;
    vector<int> stickLength(N);
    rep(i, N){
        cin >> stickLength[i];
    }
    sort(stickLength.begin(), stickLength.end());

    ans = 0;
    for(int i = 0; i < N - 2; i++){
        for(int j = i + 1 ; j < N - 1; j++){
            for(int k = j + 1; k < N; k++){
                int a, b, c;
                a = stickLength[i];
                b = stickLength[j];
                c = stickLength[k];
                if(c < a + b){
                    ans++;
                } else {
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a;
    cin >> b;
    
    if (1 <= a && a <= 9 &&
        1 <= b && b <= 9) {
            cout << a*b << endl;
        } else {
            cout << -1 << endl;
        }

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, M = map(int, input().split())

lst = [0] * (N + 1)

for _ in range(M):
    a, b = map(int, input().split())
    lst[a] += 1
    lst[b] += 1

for i in lst:
    if i % 2 == 1:
        print ('NO')
        exit()

print ('YES')

Measured memory_bytes: 3828
n=int(input())
a,b=map(int, input().split())
*p,=map(int, input().split())
mn,md,mx=0,0,0
for pi in p:
    if pi<=a:
        mn+=1
    elif pi<=b:
        md+=1
    else:
        mx+=1
print(min(mn,md,mx))


Measured memory_bytes: 9172
n=gets.to_i
a=gets.chomp.split(" ").map(&:to_i)
twoCnt=0
fourCnt=0
a.each do|num|
  if (num%4).zero?
    fourCnt+=1
  elsif (num%2).zero?
    twoCnt+=1
  end
end
if fourCnt>=n/2
  puts "Yes"
elsif n-fourCnt*2<=twoCnt
  puts "Yes"
else
  puts "No"
end


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

int main(){
    int a,b,c,x;
    int i,j,k;
    int ans = 0;

    cin >> a >> b >> c >> x;

    for (i=0; i<=a; i++){

        for (j=0; j<=b; j++){

            for (k=0; k<=c; k++){
                if (500*i+100*j+50*k==x){
                    ans += 1;
                }
            }

        }

    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256