akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main {
	public static void main(String args[]){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int a[] = new int[n];
		int b[] = new int[n - 1];
		int sum = 0;
		
		for(int i = 0; i < n - 1; i++){
		    b[i] = stdIn.nextInt();
		}
		
		sum += b[0];
		sum += b[n - 2];
		
		for(int i = 0; i < n - 2; i++){
	        if(b[i] > b[i + 1]){
	            sum += b[i + 1];
	        }else{
	            sum += b[i];
	        }
		}
		
		System.out.println(sum);
		
	}
}

Measured memory_bytes: 23124
fun main(arg: Array<String>) {
    val N = nextInt()
    val G = Array<MutableList<Int>>(N) { mutableListOf<Int>() }
    repeat(N - 1) {
        val (a, b) = listOfInt(-1)
        G[a].add(b); G[b].add(a)
    }
    //フェネック  先手  黒  1
    //すぬけくん  後手  白 -1
    val RB = IntArray(N)
    val RW = IntArray(N)
    fun dfs(R: IntArray, v: Int, p: Int = -1) {
        for (u in G[v]) {
            if (u == p) continue
            R[u] += R[v] + 1
            dfs(R, u, v)
        }
    }
    dfs(RB, 0)
    dfs(RW, N - 1)
    val M = IntArray(N)
    for (n in 0 until N) {
        M[n] = if (RB[n] <= RW[n]) 1 else -1
    }
    val Fennec = M.count { it == 1 }
    val Snuke = M.count { it == -1 }
    println(if (Fennec > Snuke) "Fennec" else "Snuke")
//System.err.println(RB.joinToString(" "))
//System.err.println(RW.joinToString(" "))
//System.err.println(M.joinToString(" "))
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 89656
// https://atcoder.jp/contests/abc161/tasks/abc161_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve() {
  ll N, M;
  cin >> N >> M;

  VL as(N);
  rep(i, N) cin >> as[i];

  ll sum = accumulate(all(as), 0ll);

  ll ct = 0;
  rep(i, N) {
    if (as[i] * 4 * M >= sum) ct++;
  }

  if (ct >= M) {
    cout << "Yes"
         << "\n";
  } else {
    cout << "No"
         << "\n";
  }
}

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif


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

int main(){
   int n, m;
   cin >> n >> m;
   if(n == m) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int A;
    int B;
    A = sc.nextInt();
    B = sc.nextInt();
    if(B%A==0){
      System.out.println(A+B);
    }
    else{
      System.out.println(B-A);
    }
  }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[100005];
ll dd[100005];

int main() {
  ll n,m;
  cin>>n>>m;
  rep(i,0,100005)d[i] = 1;
  rep(i,0,100005)dd[i] = 0;
  dd[0] = 1;
  rep(i,0,m){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    if(dd[a]==1){
      dd[b]=1;
      if(d[a]==1){
        dd[a]=0;
      }
    }
    d[a]--;
    d[b]++;
  }
  ll ans = 0;
  rep(i,0,n){
    if(dd[i]==1)ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import math
K = int(input())
ans = 0

#i<j<k
for i in range(1, K-1):
    for j in range(i+1, K):
        for k in range(j+1, K+1):
            gcd_ij_1 = math.gcd(i, j)
            gcd_ijk_1 = math.gcd(gcd_ij_1, k)
            ans = ans + gcd_ijk_1 * 6

for l in range(1, K):
    for m in range(l+1, K+1):
        gcd_lm_1 = math.gcd(l,m)
        ans = ans + gcd_lm_1 * 6

for n in range(1, K+1):
    ans = ans + n

print(ans)


Measured memory_bytes: 9204
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize,
        dv: [(usize, usize); n]
    };

    let mut c = 0;
    for (d1, d2) in dv {
        if d1 == d2 {
            c += 1;
        } else {
            c = 0;
        }
        if c == 3 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2276
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;

using namespace std;

int main() 
{
    v_int s(3);
    int K;
    irep(i,3) { cin >> s[i]; }
    cin >> K;
    sort(s.begin(), s.end());
    
    irep(i,K) {
        s[2] *= 2;
    }

    cout << s[0]+s[1]+s[2] << endl;

    return 0;
}
    



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef vector<P> vec;

double eps=1e-7;
bool eq(double a,double b){return (b-a<eps&&a-b<eps);}
double dot(P a,P b){return real(b*conj(a));}
double cross(P a,P b){return imag(b*conj(a));}
P project(P a,P b,P c){b-=a;c-=a;return a+b*real(c/b);}
P reflect(P a,P b,P c){b-=a;c-=a;return a+conj(c/b)*b;}
int ccw(P a,P b,P c){
  b-=a,c-=a,a=c*conj(b);
  if(a.imag()>eps)return 1;//ccw
  if(a.imag()<-eps)return -1;//cw
  if(a.real()<-eps)return 2;//ob
  if(abs(b)+eps<abs(c))return -2;//of
  return 0;//os
}

//segment ab , point c
double dist(P a,P b,P c){
  if(dot(b-a,c-a)<0)return abs(c-a);
  if(dot(a-b,c-b)<0)return abs(c-b);
  return abs(cross(b-a,c-a))/abs(b-a);
}

bool isintersect(P a,P b,P c,P d){
  return ((ccw(a,b,c)*ccw(a,b,d)<=0)&&(ccw(c,d,a)*ccw(c,d,b)<=0));
}

//segment ab , segment cd
P intersect(P a,P b,P c,P d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}

double dist(P a,P b,P c,P d){
  if(isintersect(a,b,c,d))return 0;
  double ab=min(dist(a,b,c),dist(a,b,d));
  double cd=min(dist(c,d,a),dist(c,d,b));
  return min(ab,cd);
}

double calcArea(vec &t){
  double res=0;
  int n=t.size();
  for(int i=0;i<n;i++)res+=cross(t[i],t[(i+1==n?0:i+1)]);
  return abs(res/2.0);
}

int main(){
  int T;
  cin>>T;
  vec t;
  double x,y;
  while(T--){
    cin>>x>>y;
    t.push_back(P(x,y));
  }
  printf("%.1f\n",calcArea(t));
  return 0;
}

Measured memory_bytes: 1260
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int N_MAX = 100001;
typedef pair<int,int> P;
int main()
{
  int n,a,b,i,j,k,l,d;
  int cc[]={1,-1},cn[]={0,0},c[N_MAX];
  bool f=1;
  vector<int> v[N_MAX];
  queue<P> q[2];
  cin >> n;
  for(i=0;i<n-1;i++){
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  fill(c+1,c+n+1,0);
  q[0].emplace(1,0);
  q[1].emplace(n,0);
  for(i=0;i<n-1;i++){
    for(j=0;j<2;j++){
      if(q[j].empty()){
        cn[1-j]=n-cn[j];
        f=0;
        break;
      }
      while(!q[j].empty()){
        k=q[j].front().first;
        d=q[j].front().second;
        if(d>i) break;
        q[j].pop();
        if(c[k]!=0) continue;
        c[k]=cc[j];
        cn[j]++;
        for(l=0;l<v[k].size();l++)
          if(c[v[k][l]]==0)
            q[j].emplace(v[k][l],d+1);
      }
    }
    if(f==0) break;
  }
  if(cn[0]>cn[1])
    cout << "Fennec" << endl;
  else
    cout << "Snuke" << endl;
  return 0;
}

Measured memory_bytes: 6400
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long N, std::vector<long long> a);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
}

void solve(long long N, std::vector<long long> a){
    ll cnt = 0;
    REP(i, N){
        if(a[i]%2 && (i+1)%2){
            cnt++;
        }
    }
    cout << cnt << el;
}



Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;

int main()
{
	int A,B,C,min;
	vector<int> ANS;
	cin >> A >> B >> C;
	
	ANS.push_back(A + B);
	ANS.push_back(A + C);
	ANS.push_back(C + B);
	ANS.push_back(A + C);
	ANS.push_back(C + A);
	ANS.push_back(B + A);

	sort(ANS.begin(), ANS.end());
	min = ANS.front();

	cout << min << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <cctype>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <limits>
#include <cmath>
#include <typeinfo>

using namespace std;
 
int main() {
	int n = 0, m = 0;
	cin >> n >> m;
	if(n == m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;		
    
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;
public class Main {

	public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int t=ob.nextInt();
		Vector<Integer> v=new Vector();
		for (int T=1; T<=t; T++) {
			int a=ob.nextInt();
			int b=ob.nextInt();
			v.add(a);
			v.add(b);
		}
		int k=0;
		for (int i=0; i<=v.size()-6; i+=2) {
			if (v.get(i)==v.get(i+1)&&v.get(i+2)==v.get(i+3)&&v.get(i+4)==v.get(i+5)) {
				k=1;
				break;
			}
		}
		if (k==1) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 27376
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let mut v: Vec<_> = line.split_whitespace()
        .map(|s| s.parse::<i32>().unwrap())
        .collect();
    v.sort();
    println!("{} {} {}", v[0], v[1], v[2]);
}



Measured memory_bytes: 5060
mod = 10**9 + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
index_change = 0
ans = 1
for i in range(n-1):
    if a[i] <= 0 and a[i+1] > 0:
        index_change = i+1
        break
else:
    if k % 2 == 1:
        for i in range(1, k+1):
            ans *= a[-i]
            ans %= mod
    else:
        for i in range(k):
            ans *= a[i]
            ans %= mod
    print(ans)
    exit()
l = 0
r = n-1
while k > 0:
    if k == 1:
        if r >= index_change:
            ans *= a[r]
            ans %= mod
            break
        else:
            ans *= a[l]*a[l+1]
            ans %= mod
            ans *= pow(a[r+1], mod-2, mod)
            ans %= mod
            break
    else:
        left = a[l]*a[l+1]
        right = a[r]*a[r-1]
        if left >= right:
            ans *= left
            ans %= mod
            l += 2
            k -= 2
        else:
            ans *= a[r]
            ans %= mod
            r -= 1
            k -= 1
print(ans)

Measured memory_bytes: 95656
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int[] a = new int[M];
            for (int i = 0; i < M; i++) {
                a[i] = in.nextInt();
            }
            final long mod = 1000000007;

            boolean[] isBroken = new boolean[N + 1 + 2];
            for (int i = 0; i < M; i++) {
                isBroken[a[i]] = true;
            }
            isBroken[N + 1] = true;
            isBroken[N + 2] = true;

            long[] stair = new long[N + 1];
            stair[0] = 1;
            for (int i = 0; i < N + 1; i++) {
                if (!isBroken[i + 1]) {
                    stair[i + 1] += stair[i];
                    stair[i + 1] %= mod;
                }
                if (!isBroken[i + 2]) {
                    stair[i + 2] += stair[i];
                    stair[i + 2] %= mod;
                }
            }
            System.out.println(stair[N]);
        }
    }
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
ll n,m;
double  ans;
vector<double> l(21), a(21), b(21);

void dfs(int idx, vector<int> v){
  if(v.size() == m){
    double tmp = 0;
    rep(x,m){
      FOR(y,x+1,m){
        int i = v[x];
        int j = v[y];
        tmp += (l[i] - l[j]) * (l[i] - l[j]) ;
        tmp += (a[i] - a[j]) * (a[i] - a[j]) ;
        tmp += (b[i] - b[j]) * (b[i] - b[j]) ;
      }
    }
    ans = max(tmp, ans);
  }
  if(idx == n) return;
  dfs(idx+1,v);
  v.push_back(idx);
  dfs(idx+1,v);
}

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

  rep(i,n){
    cin >> l[i] >> a[i] >> b[i];
  }
  vector<int> v;
  dfs(0,v);
  printf("%0.10lf\n",ans);

  return 0;
}



Measured memory_bytes: 3340
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		HashSet<Integer> set = new HashSet<Integer>();
		
		for(int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if(set.contains(tmp)) {
				System.out.println("NO");
				return;
			}
			set.add(tmp);
		}
		
		System.out.println("YES");
	}

}


Measured memory_bytes: 100588
import std.stdio, std.numeric, std.math;


ulong countPrimeFactors(ulong x) {
    ulong count = 0;
    auto s = cast(ulong) sqrt(cast(real) x);
    foreach (p; 2 .. s + 1) {
        if (x % p == 0) {
            ++count;
            while (x % p == 0) {
                x /= p;
            }
        }
    }
    if (x != 1) ++count; // x is a prime number
    return count;
}

unittest {
    assert(countPrimeFactors(2) == 1);
    assert(countPrimeFactors(3) == 1);
    assert(countPrimeFactors(6) == 2);
    assert(countPrimeFactors(40) == 2);
    assert(countPrimeFactors(6700417) == 1);
}

void main() {
    ulong a, b;
    readf("%d %d\n", &a, &b);
    writeln(countPrimeFactors(gcd(a, b)) + 1);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long n = sc.nextLong();
		long k = sc.nextLong();
		long rem = n%k;
		long remrem = Math.abs(rem-k);
		System.out.println(Math.min(rem, remrem));
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


Measured memory_bytes: 22484
#include <cstdio>
#include <vector>

using namespace std;

inline int f(const vector<int>& ws, int P, int k) {
  int v = 0;
  int c = 0;
  int ntrack = 0;
  for (size_t i = 0; i < ws.size(); ++i) {
    if (c > 0 && P > 0 && c + ws[i] > P) {
      c = 0;
      ntrack++;
    }
    if (ntrack == k) {
      break;
    }

    if (c + ws[i] <= P) {
      c += ws[i];
      v++;
    }
  }
  return v;
}

int main() {
  int n, k;

  scanf("%d %d", &n, &k);

  vector<int> ws(n);
  int max = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &ws[i]);
    max += ws[i];
  }

  int min = 1;
  int P = (min + max) / 2;
  while (min <= max) {
    const int v = f(ws, P, k);
    if (v >= n) {
      max = P - 1;
    } else { // v < n
      min = P + 1;
    }
    P = (min + max) / 2;
  }

  printf("%d\n", P+1);
  return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int A, B, C;
	cin >> A >> B >> C;

	if (A == B && B == C) co("Yes");
	else co("No");



	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;
const ll INF=1000000000;

int main(){
    ll S;
    cin >> S;
    cout << 0 << ' ' << 0 << ' ' << INF << ' ' << 1 << ' ';
    ll y=(S+INF-1)/INF;
    ll x=y*INF-S;
    cout << x << ' ' << y << endl;
}

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

long long f(vector<int> a)
{
    int n = a.size();
    vector<int> b(n);
    int x = 1;
    for (int &bb : b)
    {
        bb = x;
        x++;
    }
    long long ret = 0;
    for (bool finish = false; !finish; next_permutation(b.begin(), b.end()))
    {
        bool flag = true;
        for (int i = 0; i < n; i++)
        {
            if (a[i] != b[i])
            {
                flag = false;
            }
        }
        if (flag)
        {
            break;
        }
        else
        {
            ret++;
        }
    }
    return ret;
}

int main()
{
    int N;
    cin >> N;
    vector<int> P(N);
    for (int &p : P)
    {
        cin >> p;
    }
    vector<int> Q(N);
    for (int &q : Q)
    {
        cin >> q;
    }

    long long a = f(P);
    long long b = f(Q);
    cout << abs(a - b) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<math.h>
using namespace std;



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

    int m[N];
    int min=X;
    for(int i=0;i<N;i++){
        cin >> m[i];
        X-=m[i];
        if(min>m[i]){
            min=m[i];
        }
    }
    int ans=N+(X/min);

    cout << ans;
	return 0;
}

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

int main(){
    long long a,b;
    cin>>a>>b;
    long long ans=0;

    long long cnt=0,n=b-a,t;
    t=n+1;
    long long k[1000]={};
    k[0]=pow(2,0);

    for(int i=1;pow(2,i-1)<=b;i++){
        n=t;
        cnt=0;
        k[i]=pow(2,i);
        k[i+1]=pow(2,i+1);
        long long ka=a%k[i] , kb=b%k[i];
        if(kb>=k[i-1]){
            cnt+=kb-k[i-1]+1;
            n-=kb-k[i-1]+1;
        }

        if(ka>k[i-1]){
            cnt+=k[i]-ka;
            n-=k[i]-ka-k[i-1];
        }
        cnt+=n/k[i]*pow(2,i-1);
        if(cnt%2==1)ans+=pow(2,i-1);
        

    }

    cout<<ans;

}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

	public static void main(String[] args) {
		int N = sc.nextInt(),
				ans = 1;
		String S = sc.next();
		for(int i=1;i<N;i++) {
			if(S.charAt(i) != S.charAt(i-1)) ans++;
		}
		System.out.println(ans);
	}
}

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

ans=99999999999999999

def digit(N):
    total=0
    listN=list(str(N))
    for i in listN:
        total+=int(i)
    return total


for i in range(1,int(N/2)+1):
    A=i
    B=N-i
    ans=min(digit(A)+digit(B),ans)

print(ans)


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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef map<ll, ll> mii;
const int MOD = 1e9 + 7;

#define fastIO() \
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

int main() {
    int n;
    cin >> n;
    int k;
    cin >> k;
    vi a(n);
    for (auto& i : a)   cin >> i;
    vector<vi> dp(n, vi(k+1, 0));
    //dp[i][j] = no. of ways that [0..i] share j candies
    for (int j = 0; j <= a[0]; ++j) dp[0][j] = 1;
    for (int i = 1; i < n; ++i) {
        dp[i][0] = 1;
        //cout << dp[i][0] << " ";
        for (int j = 1; j <= k; ++j) {
            dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
            if (j - 1 - a[i] >= 0)  dp[i][j] = (dp[i][j] - dp[i - 1][j - 1 - a[i]] + MOD) % MOD;
            //cout << dp[i][j] << " ";
        }
        //cout << endl;
    }
    cout << dp[n - 1][k] << endl;
    return 0;
}


Measured memory_bytes: 79360
input()
a1 = list(map(int, input().split(' ')))
a2 = list(map(int, input().split(' ')))
s = [a1[0] + a2[0]]

for i in range(1, len(a2)):
    a1[i] = a1[i - 1] + a1[i]
    s.append(max((a1[i] + a2[i]), (s[i - 1] + a2[i])))

print(s[-1])


Measured memory_bytes: 3060
import java.util.*;

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

    int a = sc.nextInt();
    char[] op = sc.next().toCharArray();
    int b = sc.nextInt();

    

    System.out.println(op[0]=='+' ? a+b:a-b);
  }
}

Measured memory_bytes: 21204
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static const long long MOD_NUM = 1000000007LL;

static void A_task();

int main()
{
	A_task();
	fflush(stdout);
	return 0;
}

static void A_task()
{
	int A, B, C;
	get3int(A, B, C);

	if ((A + B + C) >= 22) {
		printf("bust\n");
	}
	else {
		printf("win\n");
	}
}



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

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

	int a[4];
	for (int i=3;i>=0;i--){
		a[i]=n%10;
		n=n/10;
	}

//	cout << a[0] << a[1] << a[2] << a[3] << endl;

	if (a[0]+a[1]+a[2]+a[3]==7){
		cout << a[0] << "+" << a[1] << "+" << a[2] << "+" << a[3] << "=7" << endl;
	}else if (a[0]+a[1]+a[2]-a[3]==7){
		cout << a[0] << "+" << a[1] << "+" << a[2] << "-" << a[3] << "=7" << endl;
	}else if (a[0]+a[1]-a[2]+a[3]==7){
		cout << a[0] << "+" << a[1] << "-" << a[2] << "+" << a[3] << "=7" << endl;
	}else if (a[0]-a[1]+a[2]+a[3]==7){
		cout << a[0] << "-" << a[1] << "+" << a[2] << "+" << a[3] << "=7" << endl;
	}else if (a[0]+a[1]-a[2]-a[3]==7){
		cout << a[0] << "+" << a[1] << "-" << a[2] << "-" << a[3] << "=7" << endl;
	}else if (a[0]-a[1]+a[2]-a[3]==7){
		cout << a[0] << "-" << a[1] << "+" << a[2] << "-" << a[3] << "=7" << endl;
	}else if (a[0]-a[1]-a[2]+a[3]==7){
		cout << a[0] << "-" << a[1] << "-" << a[2] << "+" << a[3] << "=7" << endl;
	}else if (a[0]-a[1]-a[2]-a[3]==7){
		cout << a[0] << "-" << a[1] << "-" << a[2] << "-" << a[3] << "=7" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin>>s;
  int n=s.size();

  ll w=0;
  ll ans=0;
  for(int i=n-1;i>=0;i--){
    if(s[i]=='W') w++;
    else{
      ans+=w;
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S; cin >> S;
    rep(i,S.size()) S.at(i) = 'x';
    cout << S << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  while (true) {
    int n, m;
    cin >> n >> m;
    if (n == 0) {
      break;
    }

    int t[n], h[m];
    int sumt = 0, sumh = 0;
    for (int i = 0; i < n; i++) {
      cin >> t[i];
      sumt += t[i];
    }
    for (int i = 0; i < m; i++) {
      cin >> h[i];
      sumh += h[i];
    }
    
    int sum = 1000000000;
    int rest, resh;
    rest = resh = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
	if (sumt - t[i] + h[j] == sumh - h[j] + t[i]) {
	  if (t[i] + h[j] < sum) {
	    sum = t[i] + h[j];
	    rest = t[i];
	    resh = h[j];
	  }
	}
      }
    }
    if (sum < 100000000)
      printf("%d %d\n", rest, resh);
    else
      cout << -1 << endl;
  }
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;


class UnionFind
{
private:
    vector<ll> p;
    vector<ll> rank;
public:
    UnionFind(ll n){
        p.resize(n,-1);
        rank.resize(n,1);
    }
    ll find(ll x){
        if(p[x]<0)return x;
        return p[x]=find(p[x]);
    }
    void unite(ll x,ll y){
        x=find(x);
        y=find(y);
		if(x==y)return;
        if(rank[x]>rank[y])swap(x,y);
        if(rank[x]==rank[y])rank[y]++;
        p[y]+=p[x];
        p[x]=y;
    }
    ll size(ll x){
        return -p[find(x)];
    }
};


signed main(){
	//cout << fixed << setprecision(10);
	int n,m; cin >> n >> m;
	UnionFind uf(n);
	rep(i,0,m){
		int a,b; cin >> a >> b;
		--a; --b;
		uf.unite(a,b);
	}
	ll ans = 0;
	rep(i,0,n){
		ll j= uf.size(i);
		chmax(ans,j);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6404
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <utility>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int n, q;
string s;
int dp[100005];
int main() {
    cin >> n >> q >> s;
    memset(dp, 0, sizeof(dp));
    for(int i = 1; i < n; ++i){
    	if(s[i] == 'C' && s[i - 1] == 'A') 
    		dp[i] = dp[i - 1] + 1;
    	else dp[i] = dp[i - 1];
    }
    //for(int i = 0; i < n; ++i) cout << dp[i] << endl;
    	
    for(int i = 0; i < q; ++i){
    	int l, r;
    	cin >> l >> r;
    	cout << dp[r - 1] - dp[l - 1] << endl;
    }
    
	return 0;
} 

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define BOX 100000000000000000LL
const int WID = 100;
long long n, k, l; unsigned long long p, q;
vector<long long>vec;
long long sum[WID * 10];
int main() {
	cin >> n >> k >> p; q = p;
	if (p == 0) { cout << "0" << endl; return 0; }
	for (int i = 0; i < n; i++) {
		long long r = p;
		long long L = r / BOX; if (r < 0LL)L--;
		sum[L + WID]++;
		p ^= p << 13; p ^= p >> 7; p ^= p << 17;
	}
	for (int i = 1; i <= WID * 2; i++) sum[i] += sum[i - 1];
	for (int i = 0; i < WID * 2; i++) { if (sum[i] >= k) { l = i - WID; break; } }
	for (int i = 0; i < n; i++) {
		long long K = (long long)q / BOX; if ((long long)q < 0)K--;
		if (l == K) vec.push_back((long long)q);
		q ^= q << 13; q ^= q >> 7; q ^= q << 17;
	}
	sort(vec.begin(), vec.end());
	cout << vec[k - sum[l + WID - 1] - 1] << endl;
	return 0;
}

Measured memory_bytes: 11260
/*
[abc136] A - Transfer
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int A, B, C;

ll solve() { return max(0, C - (A - B)); }

int main() {
    cin >> A >> B >> C;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
ka = []
n.times do
	ka << gets.split.map(&:to_i)
end

f = Hash.new(0)
ka.each do |a|
	a[1..-1].each do |k|
		f[k] += 1
	end
end
ans = 0
f.each do |k, v|
	ans += 1 if v == n
end

puts ans


Measured memory_bytes: 1788
n=int(input())
w=[[i for i in input()] for j in range(n)]
a=0
for i in range(1,n):
    for j in range(i-1):
        if w[i]==w[j]:
            a+=1
            break
    if w[i][0]!=w[i-1][-1]:
        a+=1
        break
print("Yes" if a==0 else "No")

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

int main(){
    int d, n;
    cin >> d >> n;
    
    int m=1;
    for(int i=0; i<d; i++) m *= 100;
    
    if(n==100) cout << 101*m << endl;
    else cout << n*m << endl;
}



Measured memory_bytes: 256
# include<stdio.h>
# include<stdlib.h>

int main(void){
  int n;
  scanf("%d", &n);
  int m[n];
  int i;
  for(i=0;i<n;i++){
    scanf("%d", &m[i]);
  }
  int count = 0;
  for(i=1;i<n-1;i++){
    if(m[i-1]<m[i]&&m[i]<m[i+1]){
      count += 1;
    }else if(m[i-1]>m[i]&&m[i]>m[i+1]){
      count +=1;
    }
  }
  printf("%d", count);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanNum = new Scanner(System.in);
		int a = scanNum.nextInt();
		int b = scanNum.nextInt();
		int c = scanNum.nextInt();
		int ch;
		if (a>b) {
			ch=a;
			a=b;
			b=ch;
		}
		if (b>c) {
			ch=b;
			b=c;
			c=ch;
		}
		if (a>b) {
			ch=a;
			a=b;
			b=ch;
		}
		System.out.println(a+" "+b+" "+c);
	}
}

Measured memory_bytes: 17160
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
int a[200005];
int main(){
    int n;
    cin >> n;
    int tol=0;
    rep(i,n){
        cin >> a[i];
        tol^=a[i];
    }
    rep(i,n){
        int ans=tol^a[i];
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 4344
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll modi = 1e9+7;

void sub_mod(ll &a, ll b){
	a = a-b;
	if(a<0)
		a+=modi;
	if(a>=modi)
		a-=modi;

}

ll binpow(ll a,ll b){
	ll res = 1;
	while(b>0){
		if(b&1)
			res = res*a%modi;
		a= a*a%modi;
		b>>=1;
	}
	return res;
}
	

void solve(){
	ll n;
	cin >> n;
	ll p = binpow(10,n);

	sub_mod(p,2*binpow(9,n));
	sub_mod(p,-binpow(8,n));


	cout << p << endl;

}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 3668
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String lines[] = input.readLine().split(" ");
		int n = Integer.parseInt(lines[0]);
		int k = Integer.parseInt(lines[1]);
		input.readLine();
		input.close();

		// ----- main -----
		int ans = 0;
		if(n <= k) {
			ans = 1;
		} else {
			ans = (int) (Math.ceil((float)(n - k) / (k - 1)) + 1);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 27232
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[201];

            for (int i = 1; i < 201; i++) {
                for (int j = 1; j <= i; j++) {
                    for (int k = j; j * k <= i; k++) {
                        if (j * k == i) {
                            if (j == k) {
                                a[i]++;
                            } else {
                                a[i] += 2;
                            }
                        }
                    }
                }
            }

            int sum = 0;
            for (int i = 1; i <= n; i += 2) {
                if (a[i] == 8) sum++;
            }

            System.out.println(sum);
        }
    }
}


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

N, M = map(int, input().split())

max_L, min_R = 0, N+1
for i in range(M):
    L, R = map(int, input().split())
    max_L = max(max_L, L)
    min_R = min(min_R, R)

ans = max(min_R - (max_L - 1), 0)

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
    using namespace std;
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    #define ll long long
    #define int long long
    #define lb long double
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
    #define take(a,n) f(i,0,n)cin>>a[i];
    #define show(a,n) f(i,0,n){cout<<a[i]<<" ";}
    #define ashow(a)  for(auto i:a)cout<<i<<" ";
    #define khtm     cout<<endl;
    #define all(s) s.begin(),s.end()
    #define len(a) a.length()
    #define INF 1e18
    #define MAXN 2000009
    const double pi=3.14159265358979323;
    const int mod=1e9+7;
    bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
     signed main() {

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);  
        cout.tie(0);  
     // -------------------------------------Code starts here--------------------------------------------------------------------- 
    int t=1;
    // cin>>t;
    while(t--)
    {
      

        int n,k,x=1,y=0;
        int mx=-1,mi=INF,mn=INF;
        int tm=0;
         // char c;
        cin>>n;
        int a[n+1];
        map<int,int>m;
       for(int i=1;i<n+1;i++)
        cin>>a[i];
        int p[n+2]={},s[n+2]={};
        p[1]=a[1];
        s[n]=a[n];
        for(int i=2;i<n+1;i++)
            p[i]=p[i-1]^a[i];
        for(int i=n-1;i>=1;i--)
            s[i]=s[i+1]^a[i];
        int b[n+1];
        for(int i=1;i<n+1;i++)
            b[i]=p[i-1]^s[i+1];
        for(int i=1;i<n+1;i++)
         cout<<b[i]<<" ";
     cout<<endl;

}

 }

Measured memory_bytes: 9868
#include <iostream>
#include <vector>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <unordered_set>
#define int long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

using namespace std;

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

void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

signed main()
{
	fast();
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(max(a * c, a * d), max(b * c, b * d));
	return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

using ll = long long;

constexpr ll mod = 1000000007;

ll H, W, A, B;
ll fact[200005], inv[200005];

ll powMod( ll x, ll y )
{
  ll ret = 1;

  while( y > 0 )
  {
    if( y & 1 )
      ret = (ret*x) % mod;

    x = (x*x) % mod;
    y >>= 1;
  }

  return ret;
}

ll comb( ll n, ll k )
{ return ((fact[n]*inv[n-k])%mod*inv[k])%mod; }

int main()
{
  scanf( "%lld%lld%lld%lld", &H, &W, &A, &B );

  fact[0] = 1;
  rep( i, 200000 )
    fact[i+1] = (i+1)*fact[i]%mod;

  inv[0] = 1;
  rep( i, 200000 )
    inv[i+1] = (inv[i]*powMod( i+1, mod-2 ))%mod;

  ll ans = 0;
  repi( j, B, W )
    ans = (ans + comb( H-A-1+j, j )%mod*comb( A-1+W-j-1, A-1 )%mod) % mod;

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

  return 0;
}

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

int main() {
  string a,b; cin >> a >> b;
  ll sum;
  for(ll i = 0; i<3; i++){
    if(a[i]==b[i]) sum++;
  }
  cout << sum << endl;
  
  return 0;
}



Measured memory_bytes: 256
line = input().split()
sheet = int(line[0])
total = int(line[1])
out =[0,0,0]

cnt =0

  #一万円札を数える
for x in range(1,int(total/10000)+1):
  if (int((total/1000))-sheet-9*x) %4 ==0:
    y =int((int(total/1000)-sheet-9*x)/4)
    z =sheet - y - x
    if x + y + z ==sheet and z>=0 and y>=0 and cnt ==0:
      cnt +=1
      print(x,y,z)
  #五千円札を数える
for y in range(1,int(total/5000)+1):
  z =int(total/1000)-5*y
  if z>=0 and   y + z ==sheet and cnt==0:
    cnt +=1
    print(0,y,z)
if total/1000 ==sheet and cnt==0:
  cnt +=1
  print(0,0,int(total/1000))

if cnt ==0:
  print(-1,-1,-1)

Measured memory_bytes: 3064
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        boolean found = false;

        final long A_MAX = 1000;
        final long B_MAX = 1000;

        for(long a = 0 ; a <= A_MAX && !found ; a++){
            for(long b = -B_MAX ; b <= B_MAX && !found ; b++){
                if(pow5th(a)-pow5th(b) == X){
                    System.out.println(""+a+" "+b);
                    found = true;
                }
            }
        }
    }

    public static long pow5th(long val){
        HashMap<Long, Long> log = new HashMap<>();
        if(log.containsKey(val)){
            return log.get(val);
        }
        long result = val*val;
        result = result*result*val;
        log.put(val, result);
        return result;
    }
}


Measured memory_bytes: 55624
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using static System.Console;

namespace Projection
{
    internal class Program
    {
        
        public static void Main(string[] args)
        {
            Solve();
        }

        static void Solve()
        {
            var inputs = InputLine();
            var startPos = new Vector2(inputs[0], inputs[1]);
            var endPos = new Vector2(inputs[2], inputs[3]);
            var n = int.Parse(ReadLine());

            for (var i = 0; i < n; i++)
            {
                inputs = InputLine();
                var vertex = GetProjection(startPos, endPos, new Vector2(inputs[0], inputs[1]));
                WriteLine(vertex.x + " " + vertex.y);
            }
        }

        static Vector2 GetProjection(Vector2 startPos, Vector2 endPos, Vector2 objPos)
        {
            var axisX = endPos - startPos;
            var axisY = objPos - startPos;
            var project = (Vector2.Dot(axisX, axisY) / (Vector2.Length(axisX) * Vector2.Length(axisX))) * axisX;
            return project + startPos;
        }

        static IReadOnlyList<double> InputLine()
        {
            var inputs = ReadLine()
                .Split(' ')
                .Select(double.Parse)
                .ToList();

            return inputs;
        }
        
    }

    public struct Vector2
    {
        public double x, y;

        public Vector2(double xy)
        {
            this.x = this.y = xy;
        }

        public Vector2(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
        
        public static Vector2 operator +(Vector2 a, Vector2 b)
            => new Vector2(a.x + b.x, a.y + b.y);

        public static Vector2 operator -(Vector2 a, Vector2 b)
            => new Vector2(a.x - b.x, a.y - b.y);
        

        public static Vector2 operator *(double d, Vector2 vec)
            => new Vector2(d * vec.x, d * vec.y);

        public static double Dot(Vector2 a, Vector2 b)
            => a.x * b.x + a.y * b.y;

        public static double Length(Vector2 a)
            => Math.Sqrt(a.x * a.x + a.y * a.y);
    }
    
}


Measured memory_bytes: 18444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = ll(1e8+7);
const ll MAX_N = ll(1e5 + 5);
const ll INF = LLONG_MAX;
#define REP(i, n) for (int i = 0; i < n; i++)


int main() {
    int n, k=2;
    cin >> n;
    while(n > k*(k-1)/2)k++;
    if(n == k*(k-1)/2){
        cout << "Yes" << endl;
        vector<vector<int> > g(k);
        int cnt = 1;
        for(int i = 0; i < k; i++){
            for(int j = i+1; j<k; j++){
                g[i].push_back(cnt);
                g[j].push_back(cnt);
                cnt++;
            }
        }
        cout << k << endl;
        REP(i,k){
            printf("%d",g[i].size());
            for(auto v : g[i]){
                printf(" %d",v);
            }
            printf("\n");
        }
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 2304
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		Scanner sc = new Scanner(System.in);
		main.solve(sc);
		sc.close();
	}

	void solve(Scanner sc) {
		int[] ia = new int[5];
		ia[0] = sc.nextInt();
		ia[1] = sc.nextInt();
		ia[2] = sc.nextInt();
		ia[3] = sc.nextInt();
		ia[4] = sc.nextInt();

		int sum = 0;
		int min = 9;
		int ii = 0;

		for (int i = 0; i < 5; i++) {
			if (ia[i] % 10 == 0) {
				continue;
			}
			if (ia[i] % 10 < min) {
				ii = i;
				min = ia[i] % 10;
			}
		}

		for (int i = 0; i < 5; i++) {
			if (i == ii) {
				continue;
			}

			if (ia[i] % 10 == 0) {
				sum += ia[i];
			} else {
				sum += ia[i] + (10 - ia[i] % 10);
			}
		}
		sum += ia[ii];

		System.out.println(sum);
	}
}

Measured memory_bytes: 23252