akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!(x: i32, a: i32);
    let val = if x < a {
        0
    } else {
        10
    };
    puts!("{}\n", val);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=924844033;
#define N 1055050

ll n,m,k;
string s;
vector<vec> mm(300,vec(1,-1));
vector<vector<vec>> mem(300,vector<vec>(300,vec(300,-1)));
int dfs(int l,int r,int c){
    if(c>k)return -2;
    if(l>r)return 0;
    if(l==r)return 1;
    if(mem[l][r][c]!=-1) return mem[l][r][c];
    if(s[l]==s[r]){
        return mem[l][r][c]=2+dfs(l+1,r-1,c);
    }
    int count=0;
    count=max(dfs(l+1,r,c),count);
    count=max(count,dfs(l,r-1,c));
    count=max(count,dfs(l+1,r-1,c+1)+2);
    return mem[l][r][c]=count;
}

main(){
    cin>>s;
    n=s.size();
    k=in();
    cout<<dfs(0,n-1,0);
    
}


Measured memory_bytes: 109696
#nowarn "25"

open System.Linq
open System.Text.RegularExpressions

let input() = stdin.ReadLine()
let inputs() = input().Split()
let inInt() = int (input())
let readIntArr() = inputs() |> Array.map int

let YN b = printfn "%s" (if b then "Yes" else "No")
let print x = printfn "%A" x
let printS (s: string) = printfn "%s" s



let [| A; B; K |] = readIntArr()

let CommonDivisor =
    query {
        for k in [ 100 .. -1 .. 1 ] do
            where (A % k = 0 && B % k = 0)
    }
    |> Array.ofSeq

print CommonDivisor.[K - 1]


Measured memory_bytes: 16220
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defun main(likes)
  (length (reduce #'intersection likes)))

(defun main (lines)
  (equal (sort (loop for i from 1 to 4
                     collect
                     (count i lines))
               #'<)
         (list 1 1 2 2)))

(princ (if (main (read-times 6)) "YES" "NO"))


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

int main(){
  long long n,a,b,c,d,e;
  cin >> n >> a >> b >> c >> d >> e;
  long long f = min(min(min(a,b),min(c,d)),e);
  if(n%f==0)
    cout << 5+n/f-1 << endl;
  else
    cout << 5+n/f << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>
 
using namespace __gnu_pbds;
using namespace std;
 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
// for pair comparison function(ascending order) use return (i1.ff < i2.ff);
 
/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/
 
const int M = (1<<20)+5;
const int md = 1e9+7;
 
priority_queue<ll,vector<ll >,greater<ll > > pq;
 
ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

ll dp[5000];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,j;
	cin >> n;
	dp[0] = 1;
	for(i=1;i<=n;++i)
	{
		for(j=3;j<=i;++j)
		{
			dp[i] = (dp[i] + dp[i-j])%md;
		}
	}

	cout << dp[n] << "\n";
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  string s;
  cin >> n;
  cin >> s;
  int st = 0, en = n - 1;
  int ct = 0;
  while (st < en) {
    while (st < n && s[st] == 'R')
      st++;
    while (en >= 0 && s[en] == 'W')
      en--;
    if (st < en) {
      ct++;
      swap(s[st], s[en]);
    }
  }
  cout << ct << "\n";
}

Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(), v.end()

/* デカい配列はここで宣言 */

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> v(26, 0);
    for (ll i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        vector<ll> t(26, 0);
        for (ll k = 0; k < s.size(); k++)
        {
            t[s[k] - 'a']++;
        }
        if (i != 0)
        {
            for (ll k = 0; k < 26; k++)
            {
                v[k] = min(v[k], t[k]);
            }
        }
        else
        {
            for (ll k = 0; k < 26; k++)
            {
                v[k] = t[k];
            }
        }
        
    }

    for (ll i = 0; i < 26; i++)
    {
        for (ll k = 0; k < v[i]; k++)
        {
            cout << (char)('a' + i);
        }
    }
    cout << endl;
}

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

    ll i, j, k, l, test, n;
    cin>>n;
    for(i=0;i<n;i++) cin>>a[i];

    map<ll,ll> m;

    for(i=0;i<n;i++) {
        m[a[i]]++;
    }
    ll sum=0;
    for(i=0;i<=n;i++) {
        if(m[i]>0) {
            sum+=(m[i]*(m[i]-1))/2;
            //cout<<m[i]<<" ";
        }
    }
    for(i=0;i<n;i++) {
        sum-=(m[a[i]]*(m[a[i]]-1))/2;
        k=m[a[i]]-1;
        cout<<sum+(k*(k-1))/2<<"\n";
        sum+=(m[a[i]]*(m[a[i]]-1))/2;
    }
}

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

using namespace std;

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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


constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr double EPS = 1e-10;
//constexpr int INF = 1001001001;
//constexpr ll INF = 1001001001001001001ll;

constexpr long long INF = (1LL << 31) - 1LL;


template<typename T>
struct RMQ {
    int n;
    vector<T> dat;

    RMQ(int n_) {
        n = 1; while (n < n_) n *= 2;
        dat.assign(2 * n - 1, INF);
    }
    void init(int n_) {
        n = 1; while (n < n_) n *= 2;
        dat.assign(2 * n - 1, INF);
    }

    void update(int k, T a) {
        k += n - 1;
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = min(dat[k * 2 + 1] , dat[k * 2 + 2]);
        }
    }

    T QUERY(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return dat[k];
        else {
            T vl = QUERY(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = QUERY(a, b, k * 2 + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }

    T query(int a, int b) {
        return QUERY(a, b, 0, 0, n);
    }

};

int main() {
    int n, q; cin >> n >> q;
    RMQ<ll> rmq(n);

    ll com, x, y;
    rep(i, q) {
        cin >> com >> x >> y;
        if (com == 0) {
            rmq.update(x, y);
        }
        else {
            cout << rmq.query(x, y + 1) << endl;
        }
    }


}


Measured memory_bytes: 4868
// Seek Knowledge from the cradle to the grave
// Author : Syed Mujtaba Hadi Jafri
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[100004][104][2];
signed main()
{
	string k;
	int d, ans = -1;
	int mod = 1e9 + 7;
	cin >> k >> d;
	vector < int > dig;
	for(auto z : k)
		dig.push_back(z - '0');
	reverse(dig.begin(), dig.end());
	int n = dig.size();
	for(int i = 0; i < d; i++) // Base Case
	{
		for(int j = 0; j <= 9; j++)
		{
			if((j + i)%d == 0)
				dp[0][i][0]++;		
			if(j <= dig[0])
				if((j + i)%d == 0)
					dp[0][i][1]++;						
		}
	}
	for(int i = 1; i < n; i++)
	{
		for(int j = 0; j < d; j++)
		{
			for(int z = 0; z <= 9; z++)
			{
				dp[i][j][0] = (dp[i][j][0]%mod + dp[i - 1][(j + z)%d][0]%mod)%mod;
				if(z < dig[i])
				{
					dp[i][j][1] = (dp[i][j][1]%mod + dp[i - 1][(j + z)%d][0]%mod)%mod;
				}
				if(z == dig[i])
				{
					dp[i][j][1] = ((dp[i][j][1])%mod + (dp[i - 1][(j + z)%d][1])%mod)%mod;
				}
				
			}
		}
	}
	cout << (dp[n - 1][0][1] - 1 + mod)%mod<< endl;
}


Measured memory_bytes: 16896
O = input()
E = input()

output = ''
if len(O) == len(E):
    for i in range(len(O)):
        output += O[i]
        output += E[i]
else :
    for i in range(len(O)):
        if i == len(O) -1:
            output += O[i]
        else :
            output += O[i]
            output += E[i]

print(output)

Measured memory_bytes: 3064
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start <= end) {
			f(start)
			loop(start + 1, end)(f)
		}
	
	pw.println(BigDecimal(Scanner.nextDouble() / 3.0).pow(3))

	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 25416
n = int(input())
a = list(map(int,input().split()))
ans = "APPROVED"
b=0
for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 != 0 and a[i]%5 != 0:
      ans = "DENIED"
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<iterator>
#define ll long long int
#define ld long double
#define pi acos(-1)
#define pb push_back
using namespace std;

int main()
{
    ll i,j,a,k,b,c,n,t,m,p,q,d,e,f,y,g,z,h,r,l,x;
    ld aa,bb,ee,dd,ff,kk,gg;
   vector<ll > v,s,vv;
    map<ll, ll > ta,pa,sa,ma;
    map<ll, ll > :: iterator it,ki;
    map<pair<ll,ll>,ll  > me;
//    priority_queue<ll > aq,tq,pq,nq,mq,xq;
  string st,et,ft,pt,ct;
//    deque<ll> de,ne;
//    set<ll> li;
    ios_base::sync_with_stdio(false);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    cin>>c>>r>>m;
    for(i=0;i<m;i++){
            cin>>a>>b;
            ma[a]++;
            sa[b]++;
            me[{a,b}] = 1;
    }
    d = 0;
    for( it = ma.begin();it!=ma.end();it++){
        if(((*it).second)>d)d = (*it).second;
    }
    e = 0;
    for( it = sa.begin();it!=sa.end();it++){
        if(((*it).second)>e)e = (*it).second;
    }
    for( it = ma.begin();it!=ma.end();it++){
        if(((*it).second)==d){f = (*it).first;v.pb(f);}
    }
    for( it = sa.begin();it!=sa.end();it++){
        if(((*it).second)==e){f=(*it).first;s.pb(f);}
    }
    f = 0;
    for(i=0;i<v.size();i++){
        a = v[i];
        for(j=0;j<s.size();j++){
            b = s[j];
            if(me[{a,b}]==0){f=1;break;}
        }
    }
    if(f==0)cout<<d+e-1<<endl;
    else cout<<d+e<<endl;
}


Measured memory_bytes: 82844
#include <iostream>

using namespace std;
#include <string>
typedef long long int ll;

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

  int n=0;
  int kuti = 1;

  while (kuti<B) {
    n++;
    kuti = (A-1)*n+1;
  }
  cout << n;

  return 0;
}


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

using namespace std ;

int main()
{
    long long int x,k,d,min;
    cin>>x>>k>>d;
    long long int m=abs(x);
    if(k<=m/d)
    {
        min=m-k*d;
    }
    else
    {
        if((k-(m/d))%2==0)
        {
            min=m%d; 
        }
        else
        {
            min=d-(m%d);  
        }
    }
    cout<<min;
}

Measured memory_bytes: 3640
a, b, c = map(int, input().split())
ans = 0
if(a % 2 == b % 2 and b % 2 != c % 2 and a % 2 != c % 2):
    a += 1
    b += 1
    ans += 1
elif(a % 2 != b % 2 and b % 2 != c % 2 and a % 2 == c % 2):
    a += 1
    c += 1
    ans += 1
elif (a % 2 != b % 2 and b % 2 == c % 2 and a % 2 != c % 2):
    b += 1
    c += 1
    ans += 1
maxValue = max(a, b, c)
ans += int((maxValue - a) / 2 + (maxValue - b) / 2 + (maxValue - c) / 2)
print(ans)



Measured memory_bytes: 3064
N = int(input())
S = input()
E = S.count('E')
W = N - E
result = N
l = 0
r = E
for i in S:
  if i == 'E':
    r-=1
    result = min(result, l+r)
  elif i == 'W':
    result = min(result, l+r)
    l+=1

print(result)

Measured memory_bytes: 42200
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		char op = sc.next().toCharArray()[0];
		int b = sc.nextInt();
		for (; op != '?';) {
			int result;
			switch (op) {
			case '+':
				result = a + b;
				break;
			case '-':
				result = a - b;
				break;
			case '*':
				result = a * b;
				break;
			case '/':
				result = a / b;
				break;
			default:
				result = -1;
			}
			System.out.println(result);
			a = sc.nextInt();
			op = sc.next().toCharArray()[0];
			b = sc.nextInt();
		}
	}
}

Measured memory_bytes: 17196
#include<stdio.h>
int main(){
  int m,n,i,r;
  int a[2000000];

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

  m=a[0];
  r=a[1]-m; 
  if(r<0) m=a[1];
  
  for(i=2;i<n;i++){
    if(a[i]-m>r) r=a[i]-m;
    if(m>a[i]) m=a[i];
  }

  printf("%d\n",r);
  return 0;
}



Measured memory_bytes: 2572
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;
//#define _USE_MATH_DEFINES

int main(void) {
    int n;
    cin >> n;
    if (n % 2 == 0) {
        cout << n << endl;
    }
    else {
        cout << 2 * n << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import math
import collections


def nc2(n):
    if n <= 1:
        return 0
    return math.factorial(n)//(2*math.factorial(n-2))


n = int(input())
a = list(map(int, input().split()))

cnt = collections.Counter(a)
each_ans = {}
for key, value in cnt.items():
    t = nc2(value)
    each_ans[key] = (t, t-value+1)
all_sum = sum(value[0] for _, value in each_ans.items())
ans = {}
for key in cnt.keys():
    ans[key] = all_sum - each_ans[key][0] + each_ans[key][1]
for i in a:
    print(ans[i])


Measured memory_bytes: 49324
Var a,f,g:Array[0 .. 1000000] of Longint;
    i,n:Longint;
Begin
    Readln(n); For i:=1 to n do read(a[i]); f[0]:=0; g[n+1]:=0;
    For i:=1 to n do f[i]:=f[i-1]+abs(a[i]-a[i-1]);
    For i:=n downto 1 do g[i]:=g[i+1]+abs(a[i+1]-a[i]);
    For i:=1 to n do writeln(f[i-1]+g[i+1]+abs(a[i+1]-a[i-1]));
End.

Measured memory_bytes: 9600
S = input()
#6文字の入力を配列S[0,1,2,3,4,5]に格納

if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
#もし、配列S[2]とS[3]が等しく、かつ配列S[4]とS[5]が等しければ、
#Yesを出力する
else:
    print("No")  
#それ以外の場合はNoを出力する

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

using namespace std;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	
	string s;
	cin >> s;

	string t;
	cin >> t;

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

	sort(t.begin(), t.end(), std::greater<int>());

	if (s < t)cout << "Yes\n"; else cout << "No\n";


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    char a[105][105];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        cout<<a[i]<<endl<<a[i]<<endl;
    }
    return 0;
}


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

int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	int rsum = 0, gsum = 0, bsum = 0;
	for(char c : S){
		if(c == 'R')
			rsum++;
		else if(c == 'G')
			gsum++;
		else
			bsum++;
	}
	vector<int> rrem(N), grem(N), brem(N);
	for(int i = 0; i < N; i++){
		if(S[i] == 'R')
			rsum--;
		else if(S[i] == 'G')
			gsum--;
		else
			bsum--;
		rrem.at(i) = rsum;
		grem.at(i) = gsum;
		brem.at(i) = bsum;
	}

	ll sum = 0;
	for(int i = 0; i < N-2; i++){
		for(int j = i+1; j < N-1; j++){
			if((S[i] == 'G' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'G'))
				sum += rrem.at(j);
			else if((S[i] == 'G' && S[j] == 'R') || (S[i] == 'R' && S[j] == 'G'))
				sum += brem.at(j);
			else if((S[i] == 'B' && S[j] == 'R') || (S[i] == 'R' && S[j] == 'B'))
				sum += grem.at(j);
			else
				continue;
			if(2*j-i < N){
				if(S[2*j-i] != S[j] && S[2*j-i] != S[i]){
					sum--;
				}
			}
		}
	}
	cout << sum << endl;

	return 0;	
}

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

const int NMAX = 1e6 + 1;
bool freq[NMAX];
int sol, k, rest;

int main()
{
    cin >> k;
    while(1) {
        rest = (rest * 10 + 7) % k;
        sol++;
        if(rest == 0) {
            cout << sol;
            break;
        }
        if(freq[rest]) {
            cout << -1;
            break;
        }
        freq[rest] = 1;
    }
    return 0;
}

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

int main(){
   int N;
   string S;
   cin >> N >> S;

   if (N%2 == 0) {
      if (S.substr(0, N/2) == S.substr(N/2, N/2))
         cout << "Yes" << endl;
      else
         cout << "No" << endl;
   }else
      cout << "No" << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false)
#define pdl cout << "*" << endl
#define MOD 1000000007
#define INF 1000000000
#define INFLL 1000000000000000000ll
#define ff first
#define ss second
#define long int64_t
using namespace std;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<> dis(0, INF<<1);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args)
{ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma+1, args...); }

const int N = 200001;

int main()
{
	fio;
	int n, k;
	cin >> n >> k;
	int ans = (k > 1 ? n - k : 0);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

template <class T>
class SegmentTree
{
private:
    int n;
    const T unit = (T)1e15;
    //T unit = -1e15;
    //T unit = 0;
    vector<T> node;

public:
    SegmentTree(int n_)
    {
        this->n = 1;
        while (this->n < n_)
        {
            this->n *= 2;
        }
        this->node.resize(2 * n - 1, this->unit);
    }

    SegmentTree(vector<T> v)
    {
        int n_ = v.size();
        this->n = 1;
        while (this->n < n_)
        {
            this->n *= 2;
        }
        node.resize(2 * this->n - 1, this->unit);
        for (int i = 0; i < this->n; i++)
        {
            this->node[this->n - 1 + i] = v[i];
        }
        for (int i = this->n - 2; i >= 0; i--)
        {
            this->node[i] = min(this->node[i * 2 + 1], this->node[i * 2 + 2]);
        }
    }

    void update(int idx, T val)
    {
        idx += this->n - 1;
        this->node[idx] = val;
        while (idx)
        {
            idx = (idx - 1) / 2;
            this->node[idx] = min(this->node[2 * idx + 1], this->node[2 * idx + 2]);
        }
    }

    T getmin(int a, int b, int now = 0, int l = 0, int r = -1)
    {
        if (r < 0)
        {
            r = this->n;
        }
        if (r <= a || b <= l)
        {
            return this->unit;
        }
        if (a <= l && r <= b)
        {
            return this->node[now];
        }
        T lVal = getmin(a, b, 2 * now + 1, l, (l + r) / 2);
        T rVal = getmin(a, b, 2 * now + 2, (l + r) / 2, r);
        return min(lVal, rVal);
    }
};

void solve()
{
    int n, q;
    cin >> n >> q;
    vector<long> v(n, (1LL << 31) - 1);
    SegmentTree<long> segtree(v);
    while (q--)
    {
        long c, x, y;
        cin >> c >> x >> y;
        if (c)
        {
            cout << segtree.getmin(x, y + 1) << '\n';
        }
        else
        {
            segtree.update(x, y);
        }
    }
}

int main()
{
    solve();
    return 0;
}



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

int main(void){
    string s, p;
    cin >> s >> p;
    s = s + s;
//    cout << s << endl << p;
    if(s.find(p) == string::npos) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3216
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	BufferSize = 2*10*10*10*10*10 + 10
)

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}

	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}

	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func ngTLE() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	a := make([]int, n, n)

	for i := 0; i < n; i++ {
		a[i] = scanInt(sc)
	}

	// 各入力に対して約数を1～走査
	divisors := make(map[int]int)
	// 各入力に対して走査
	for i := 0; i < n; i++ {
		// 約数1～走査
		for div := 1; div <= a[i]; div++ {
			if a[i]%div == 0 {
				if _, ok := divisors[div]; !ok {
					divisors[div] = 1
				} else {
					divisors[div]++
				}
			}
		}
	}

	max := 0
	for k, v := range divisors {
		// 1入力書き換えで最大公約数になれないものは除外
		if v < n-1 {
			continue
		}

		if k > max {
			max = k
		}
	}

	fmt.Printf("%d\n", max)
}

func gcd(a int, b int) int {
	if b == 0 {
		return a
	}

	return gcd(b, a%b)
}

func ac() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	a := make([]int, n, n)

	for i := 0; i < n; i++ {
		a[i] = int(scanInt(sc))
	}

	left := make([]int, n+1, n+1)
	right := make([]int, n+1, n+1)

	for i := 0; i < n; i++ {
		left[i+1] = gcd(left[i], a[i])
	}
	for i := n - 1; i >= 0; i-- {
		right[i] = gcd(right[i+1], a[i])
	}
	// fmt.Printf("### a     = %+v\n", a)
	// fmt.Printf("### left  = %+v\n", left)
	// fmt.Printf("### right = %+v\n", right)

	max := 0
	for i := 0; i < n; i++ {
		l := left[i]
		r := right[i+1]

		tmp := gcd(l, r)
		if tmp > max {
			max = tmp
		}
	}

	fmt.Printf("%d\n", max)
}

func main() {
	// ngTLE()
	ac()
}


Measured memory_bytes: 4864
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n[12]={0},i;
	for(i=0;i<12;i++){
		cin>>n[i];
	}
	sort(n,n+12);
	if(n[0]==n[1]&&n[0]==n[2]&&n[0]==n[3]){
		if(n[4]==n[5]&&n[4]==n[6]&&n[4]==n[7]){
			if(n[8]==n[9]&&n[8]==n[10]&&n[8]==n[11]){
				cout<<"yes"<<endl;
			}else{
				cout<<"no"<<endl;
			}
		}else{
			cout<<"no"<<endl;
		}
	}else{
		cout<<"no"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3096
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if  a[0] + a[1]>a[2]+a[3]:
       print("Left")
    elif a[0] + a[1]==a[2]+a[3]:
        print("Balanced")
    else:
        print("Right")


Measured memory_bytes: 3828
#include <stdio.h>

int main (void)
{
    int n, a[10000];
    int i, ans = 0;

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

    i = 0;
    while (i < n) {
        if (a[i] % 2) {
            i++;
            continue;
        }
        a[i] /= 2;
        ans++;
        i = 0;
    }
    printf("%d\n", ans);
}


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

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

    vector<bool> n(10);
    n[A] = true;
    n[B] = true;
    n[C] = true;
    n[D] = true;

    if (n[1] && n[7] && n[9] && n[4])
        cout << "YES\n";
    else
        cout << "NO\n";
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

typedef long long ll;

int n;
ll a[90];

int main() {
  scanf("%d", &n);
  a[0] = 2;
  a[1] = 1;
  for (int i = 2; i <= n; i++) {
    a[i] = a[i - 1] + a[i - 2];
  }
  printf("%lld\n", a[n]);
  return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split())) + [0]
B = [0]*(N+1)

for i in range(N-1):
    B[N-i-1] = A[N-i-1]+B[N-i]
ans = 0
MOD = 10**9 + 7

for i in range(N-1):
    ans = (ans + A[i]*B[i+1])%MOD
        
print(ans)

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

using namespace std;

int main(){
	long n, tmp;
	while(cin >> n, n){
		vector<long> polong;
		long min = 1000001;
		long res;
		for(long i=0;i<n;i++){
			cin >> tmp;
			polong.push_back(tmp);
		}
		sort(polong.begin(),polong.end(),greater<long>());

		for(long i=0;i<n-1;i++){
			if(polong[i] - polong[i+1] < min){
				min = polong[i] - polong[i+1];
			}
		}
		cout << min << endl;
	}
}

Measured memory_bytes: 3100
#define _GLIBCXX_DEBUG
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)

void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        while (x) {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 3180
// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
void build(){

}
LL a , b;
void init(){
  a = getint();
  b = getint();
}
void solve(){
  if( a <= 0 && 0 <= b ) puts( "Zero" );
  else{
    LL neg = a < 0 ? -a : 0;
    neg -= b < 0 ? -b - 1 : 0;
    puts( neg % 2 ? "Negative" : "Positive" );
  }
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int n;

signed main() {
   cin >> n;
   int Max = 0;
   vec<int> v;
   rep (i, n) {
      int x;
      cin >> x;
      v.push_back(x);
   }
   sort(all(v));
   Max = v.back();
   v.pop_back();

   int ans = 0;
   int a = 0, b = 0;
   if (Max % 2 == 0) {
      a = Max / 2, b = Max / 2 + 1;
   } else {
      a = Max / 2 + 1, b = Max / 2 + 1;
   }

   int r = 0;
   int Min = 1e15;
   int difMin = 1e15;
   rep (i, n-1) {
      int dif = min(abs(a - v[i]), abs(b - v[i]));
      // dbg2(abs(a - v[i]), abs(b - v[i]));
      if (dif < difMin) {
         Min = v[i];
         difMin = dif;
      }
   }

   printf("%lld %lld\n", Max, Min);

   return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  int n, m; cin >> n >> m;
  vector<int> v(n, 0);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b --;
    v[a] ++, v[b] ++;
  }

  string ans = "YES";
  rep(i, n) {
    if (v[i] % 2 == 1) ans = "NO";
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <map>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)

//abbreviations
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define vvi vector<vector<int>>

using namespace std;

int main(){
    string S;
    cin>>S;
    int x = S.size();
    cout << S.replace(0, x, x, 'x') << endl;

    return 0;
}

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

#define gap " "
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ok cout<<"ok"<<endl
#define dbg(x) cout<<(#x)<<" is "<<x<<endl
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}

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

const int N=100009;

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

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

 
int main() {
    int n;
    cin>>n;
    map<ll,ll> A;

    rep(i,n){
        int a;
        cin>>a;
        A[a]++;
    }

    ll ans=0;
    for(auto p:A){
        if(p.second%2==1)ans++;
    }

    cout<<ans<<endl;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

class UnionFind {
public:
	int n;
	vi par; //親
	vi ran; //木の深さ
	vi num; //要素数

	UnionFind(int _n) {
		n = _n;
		par.resize(n); ran.resize(n); num.resize(n);
		for (int i = 0; i < n; i++) {
			par[i] = i; ran[i] = 0; num[i] = 1;
		}
	}

	//木の根を求める
	int find(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = find(par[x]);
		}
	}

	//xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x); y = find(y);
		int numsum = num[x] + num[y];
		if (x == y) {
			return;
		}
		if (ran[x]<ran[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (ran[x] == ran[y]) {
				ran[x]++;
			}
		}
		num[x] = num[y] = numsum;
	}

	//xとyが同じ集合に属するか否か
	bool same(int x, int y) {
		return find(x) == find(y);
	}

};


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

  int ans = n;
  UnionFind uf(n);
  rep (i, m) {
    int x, y, z;
    cin >> x >> y >> z;
    x--; y--;
    if (!uf.same(x, y)) {
      uf.unite(x, y);
      ans--;
    }
  }
  cout << ans << endl;
  
}


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

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
using ll=long long;

signed main() {
    ll K; cin >> K;
    ll rec[60], ans[60];
    ll div = K / 50, md = K % 50;
    rep(i,0,50) rec[i] = div + (i < md);
 
    rep(i,0,50) {
        ll S = 0;
        rep(j,0,50) {
            if(i != j) S += rec[j];
        }
        ans[i] = 50 * (rec[i] + 1) - S - 1;
    }
    cout << 50 << endl;
    rep(i,0,50) cout << (i ? " " : "") << ans[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
t = set()
q = int(input())

for i in range(q):
    a = input().split()
    x = int(a[1])
    if a[0] == '0':
        t.add(x)
        print(len(t))
    elif a[0] == '1': print(1 if x in t else 0)
    else:
        if x in t: t.remove(x)


Measured memory_bytes: 23356
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if(A == B) {
			System.out.println(C);
		} else if(B == C) {
			System.out.println(A);
		} else {
			System.out.println(B);
		}
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	ll cp=n;
	for(ll i=2;i*i<=cp;i++){
		if(cp%i==0){
			while(cp%i==0){
				cp/=i;
				if(cp==1)break;
			}
			if(cp==1)break;
		}
	}
	if(cp==n){
		cout << n-1 << endl;
		return 0;
	}
	for(ll i=sqrtl(n);i>=i;i--){
		if(n%i==0){
			cout << i-1+n/i-1 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
// atcoder.jp/contests/dp/tasks/dp_d
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

#define ll long long
#define rep(i, s, n) for (ll i = s; i < n; ++i)
#define repm(i, s, n) for (ll i = s; n < i; --i)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define MOD 1000000007

using namespace std;

string solve(string s, string t) {
    int sl = s.length();
    int tl = t.length();
    int dp[sl + 1][tl + 1]{};

    rep(i, 0, sl) {
        rep(j, 0, tl) { dp[i][j] = 0; }
    }

    rep(i, 0, sl) {
        rep(j, 0, tl) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] =
                    max(dp[i + 1][j], max(dp[i][j + 1], dp[i][j] + 1));
            } else {
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
    }
    //    rep(i, 0, sl) {
    //        rep(j, 0, tl) { cout << dp[i][j] << ' '; }
    //        cout << endl;
    //    }

    string ans = "";
    int p = sl;
    int q = tl;
    while (p > 0 && q > 0) {
        if (dp[p][q] == dp[p - 1][q]) {
            --p;
        } else if (dp[p][q] == dp[p][q - 1]) {
            --q;
        } else {
            --p;
            --q;
            ans += s[p];
        }
    }
    reverse(ans.begin(), ans.end());

    return ans;
}

int main() {
    string s, t;

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> s;
    cin >> t;

    string ans = solve(s, t);
    cout << ans << endl;
}


Measured memory_bytes: 38760
#include <iostream>
#include <string>

using namespace std;

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

int main(void)
{
    int n;
    string s;
    cin >> n >> s;

    int putFirst = 0;
    int putLast = 0;
    int nowCount = 0;
    REP(i, n)
    {
        if (s[i] == '(')
        {
            nowCount++;
        }
        else
        {
            nowCount--;
            if (nowCount == -1)
            {
                nowCount = 0;
                putFirst++;
            }
        }
    }
    putLast = nowCount;

    REP(i, putFirst)
    {
        cout << '(';
    }
    cout << s;
    REP(i, putLast)
    {
        cout << ')';
    }
    cout << endl;

    return 0;
}

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

num4 = 0
num2 = 0
num1 = 0

for i in range(N):
    if a[i] % 4 == 0:
        num4 += 1
    elif a[i] % 2 == 0:
        num2 += 1
    else:
        num1 += 1

if (num1 <= num4 + 1) & (num2 == 0):
    print("Yes")
elif (num1 <= num4) & (num2 != 0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, x, t;
	char ch, c[4] = {'S', 'H', 'C', 'D'};
	bool b[60];
	memset(b, false, sizeof(b));
	cin >> n;
	for(int i=1; i<=n; i++){
		cin >> ch >> x;
		for(int j=0; j<4; j++){
			if(ch==c[j]){
				t = j*13+x;
				break;
			}
		}
		b[t] = true;
	}
	for(int i=1; i<=52; i++){
		if(!b[i]){
			cout << c[(i-1)/13] << " " << (i-1)%13+1 << endl;
		}
	}
	return 0;
}


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

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class T> ostream& operator<<(ostream &os, set<T> S){os << "{ "; for(auto s:S) os<<s<<" "; return os<<"}";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {os << "{ "; for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") "; return os<<"}";}
#ifdef np
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>void __f(const char *name, Arg1 &&arg1) { cout<<name<<" : "<<arg1<<endl;}
template<typename Arg1, typename ... Args>void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,','); cout.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif


int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
	
    ll n ; cin >> n;
	if(n%2==0){
		ll cnt = 0;ll i  = 5 ;
		while(n/(2*i)>0) {
			cnt+=(n/(2*i));
			i*=5;
		}
		cout<<cnt;
	}
	else cout<<0;
	
    

#ifdef np
    cerr <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
 return 0; 
 }


Measured memory_bytes: 256