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

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    priority_queue<P> Q;
    for (int i = 0; i < N; i++) {
        if (A[i] < B[i]) {
            Q.emplace(B[i], i);
        }
    }
    ll ans = 0;
    while (!Q.empty()) {
        P p = Q.top(); Q.pop();
        int cur = p.second;
        int prv = (cur + N - 1) % N;
        int nxt = (cur + 1) % N;
        int sum = B[prv] + B[nxt];
        if (B[cur] <= sum) {
            cout << -1 << endl;
            return 0;
        }
        if ((B[cur] - A[cur]) % sum == 0) {
            ans += (B[cur] - A[cur]) / sum;
            B[cur] = A[cur];
            continue;
        }
        ans += B[cur] / sum;
        B[cur] %= sum;
        if (A[cur] < B[cur]) {
            Q.emplace(B[cur], cur);
        }
    }
    for (int i = 0; i < N; i++) {
        if (A[i] != B[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
 }

Measured memory_bytes: 3956
#include<stdio.h>
int main()
{
	int x, i, a;
	scanf("%d", &x);
	for (i = 1; i <= 100000; i++) {
		if (x >= 100 * i && x <= 105 * i) {
			printf("1\n");
			break;
		}
		else if (i * 100 >= x) {
			printf("0\n");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 128
def sol():
  ti = 0
  ans = lenX
  for i in range(lenX//2):
    while S[i]>=T[ti]:
      ti += 1
      if ti>=lenX//2:return ans
    ans -= 2    
    ti += 1
    if ti>=lenX//2:return ans
  return ans

X = input()
lenX = len(X)
S = []
T = []
for i,x in enumerate(X):
  if x == 'S':S.append(i)
  else:T.append(i)

print(sol())

Measured memory_bytes: 51292
use std::io;
use std::f64::consts::PI;

fn main() {
  let stdin = io::stdin();
  let mut buf = String::new();
  stdin.read_line(&mut buf).unwrap();

  let r = buf.trim().parse::<f64>().unwrap();

  println!("{} {}", r * r * PI, r * 2.0 * PI);
}



Measured memory_bytes: 5060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int i=10;
	while(1){
		if(b%i==b){
			break;
		}
		i*=10;
	}
	a=a*i+b;
	for(i=1;;i++){
		if(i*i==a){
			printf("Yes\n");
			return 0;
		}
		if(i*i>a){
			printf("No\n");
			return 0;
		}
	}																																																													                                            																																																																									 																																								                                                                                        																																																																																																																									                                                                                 																																																																									
    return 0;
}

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

import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		String d = sc.next() + "________";
		String ans = "";
		HashSet<String> aidunyan = azunyan();
		for (int i=0;i<d.length() - 8;i++) {
			if (aidunyan.contains(d.substring(i, i+8))) {
				ans += "AIZUNYAN";
				i += 7;
			} else {
				ans += d.charAt(i);
			}
		}
		System.out.println(ans);
	}

	HashSet<String> azunyan() {
		int[] az = {'A', 'I', 'D', 'U', 'N', 'Y', 'A', 'N'};
		sort(az);
		Permutation p = new Permutation(az.length);
		p.set(az);
		HashSet<String> set = new HashSet<String>();
		while (p.hasNext()) {
			int[] pure = p.next();
			set.add(ar2str(pure));
		}
		return set;
	}
	
	String ar2str(int[] ar) {
		String s = "";
		for (int i : ar) {
			s += (char)i;
		}
		return s;
	}

	class Permutation {
		private final int size;

		public Permutation(int size) {
			if (size <= 0) throw new IllegalArgumentException();
			this.size = size;
			source = new int[size];
		}
		
		void set(int[] source) {
			System.arraycopy(source, 0, this.source, 0, size);
		}

		int[] source;
		boolean isFirst = true;

		public boolean hasNext() {
			if (isFirst) {
				isFirst = false;
				return true;
			}

			int n = source.length;
			for (int i = n - 1; i > 0; i--) {
				if (source[i - 1] < source[i]) {
					int j = n;
					while (source[i - 1] >= source[--j]);
					swap(source, i - 1, j);
					reverse(source, i, n);
					return true;
				}
			}
			reverse(source, 0, n);
			return false;
		}

		public int[] next() {
			return source;
		}

		private void swap(int[] is, int i, int j) {
			int t = is[i];
			is[i] = is[j];
			is[j] = t;
		}

		private void reverse(int[] is, int s, int t) {
			while (s < --t) swap(is, s++, t);
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 36132
#include<stdio.h>

int main(void){
  int a,b,c,d,i=1;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  while(i==1){
      c-=b;
      if(c<=0){
          printf("Yes");
          i=0;
      }
      else{
          a-=d;
          if(a<=0){
              printf("No");
              i=0;
          }
      }
  }
}

Measured memory_bytes: 1736
#include <stdio.h>

int asumisu;
double mizuhasu[64];

void minorinn(int pos) {
	for (;;) {
		int minPos = pos;
		int i;
		for (i = 1; i <= 2; i++) {
			int c = pos * 2 + i;
			if (c < asumisu && mizuhasu[c] < mizuhasu[minPos]) {
				minPos = c;
			}
		}
		if (minPos == pos) {
			if (pos == 0) break;
			pos = (pos - 1) / 2;
		} else {
			double t = mizuhasu[pos];
			mizuhasu[pos] = mizuhasu[minPos];
			mizuhasu[minPos] = t;
			pos = minPos;
		}
	}
}

void mamegu(double value) {
	mizuhasu[asumisu++] = value;
	minorinn(asumisu - 1);
}

double emirinn(void) {
	double ret;
	if (asumisu <= 0) return 0;
	ret = mizuhasu[0];
	asumisu--;
	if (asumisu > 0) {
		mizuhasu[0] = mizuhasu[asumisu];
		minorinn(0);
	}
	return ret;
}

int main(void) {
	int N;
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		double v;
		if (scanf("%lf", &v) != 1) return 1;
		mamegu(v);
	}
	for (i = N; i > 1; i--) {
		double a = emirinn();
		double b = emirinn();
		mamegu((a + b) / 2.0);
	}
	printf("%.15f\n", emirinn());
	return 0;
}

/*

   割る
→ その分価値が減る
→ なるべく被害を減らしたい
→ もともと小さいやつを貪欲に削る

*/


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
typedef long long ll;
using namespace std;
int main(){
    ll n,a[5],ans=0,f;
    scanf("%lld",&n);
    for(ll i=0;i<5;i++){
        scanf("%lld",&a[i]);
        if(n%a[i]){
            f=1;
        }
        else{
            f=0;
        }
        ans=max(ans,f+n/a[i]+4);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//17:25~

int main() {
  int H,W;
  cin >> H >> W;
  char c[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++)cin >> c[i][j];
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(c[i][j]=='.'){
        int sum=0;
        for(int x=-1;x<2;x++){
          for(int y=-1;y<2;y++){
            if(0<=i+x && i+x<H && 0<=j+y && j+y<W && c[i+x][j+y]=='#')sum++;
          }
        }
        c[i][j]=to_string(sum)[0];
      }
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout << c[i][j];
    }
    cout << endl;
  }
}



Measured memory_bytes: 256
import java.util.Scanner;

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

    long N = sc.nextLong();
    long min = N;

    for(long i = 1; i <= Math.sqrt(N); i++){
      if(N % i == 0){
        if(min > i + N/i - 2){
          min = i + N/i - 2;
        }
      }
    }

    System.out.println(min);
  }
}


Measured memory_bytes: 21972
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace::std;
using ll = long long int;

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    for(int i=0; i<n; i++){
        cin >> vec[i];
    }
    ll ans = pow(10, 10);
    ll val = 0;
    for(int i=-100; i<101; i++){
        val = 0;
        for(auto& v:vec){
            val += pow(abs(v-i), 2);
        }
        ans = min(ans, val);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int n, k;
  readf("%s %s\n", &n, &k);
  auto hs = new int[](n);
  foreach (ref e; hs) {
    e = readln.chomp.to!int;
  }
  sort(hs);
  
  auto res = int.max;
  foreach (i; k-1..n) {
    res = min(res, hs[i] - hs[i-k+1]);
  }
  res.writeln;
}


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

void next(string& str)
{
	for(int i=0; i<str.length(); i++)
	{
		if('a'<=str[i] && str[i]<='z')
		{
			str[i] = ((str[i]-'a'+25)%26)+'a';
		}
	}
}

int main()
{
	string str;
	while(getline(cin,str))
	{
		for(int i=0; i<26; ++i,next(str))
		{
			if(-1!=str.find("the") || -1!=str.find("this") || -1!=str.find("that"))
			{
				cout << str << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    
    int n,m;cin >> n;

    double ans = (n%2)?(n/2+1)/(1.0*n):0.5;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

        String[] s = sc.next().split("");
        sc.close();

        Arrays.sort(s);

        String str = String.join("", s);
        String zero = str.replace("1", "");
        String one = str.replace("0", "");

        int num = Math.abs(zero.length() - one.length());

        System.out.println(str.length() - num);
    }
}

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

using namespace std;

const int OO = 0x3f3f3f3f;
//const long long OO = (long long) 1e18L+7;
//const unsigned long long UOO = (long long) 10e18+7;
#define lp(i,a,n) for(long long i = a ; i < n ; ++i)
#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)
#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)
#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)
#define eps (1e-5)
#define pb(i) push_back(i)
#define EPS 1e-9
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef vector<int> vi ;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll ;
typedef pair<int,int> pii ;
typedef vector< pair<int,int> >  vpii;
typedef vector<pair<long long,long long>> vpll;
typedef vector<vector<int> > vvi ;
typedef complex<double> point;
typedef pair<ll,ll> pll;

ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}
ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p
ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}
ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }
ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//int i=uniform_int_distribution<int>(1,n)(rng);




int main()
{
    #ifndef ONLINE_JUDGE
    //   freopen( "output.txt" , "w" , stdout ) ;
    //   freopen( "input.txt" , "r" , stdin ) ;
    auto stTime = clock();
    mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
///-----------------------------------------------------------------------------------
    int n;
    cin >> n;
    vector<double> dp(n+1,0);
    dp[0] = 1;
    lp(i,0,n){
        double t;
        cin >> t;
        lpr(i,n,0){
            dp[i] = (i == 0 ? 0 : dp[i-1] * t) + dp[i] * (1-t);
        }

    }
    double ans = 0;
    lp(i,0,n+1){
        if(i > n -i) ans += dp[i];
    }
    cout << fixed << setprecision(10) << ans;











///------------------------------------------------------------------------------------
    #ifndef ONLINE_JUDGE
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif

    return 0;
}


Measured memory_bytes: 3856
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(isize);
    let a = get!([isize]);

    let sum = a.iter().sum::<isize>();
    let one = n*(n+1)/2;
    if sum % one > 0 {
        println!("NO");
        return;
    }
    let k = sum/one;
    let mut s = 0;
    for i in 0..n {
        let b = a[((i+1)%n) as usize] - a[i as usize];
        if (k-b)%n > 0 {
            println!("NO");
            return;
        }
        let t = (k-b)/n;
        if t < 0 {
            println!("NO");
            return;
        }
        s += t;
    }
    if s == k {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

int main() {
    int n;
    cin >> n;
    int64_t ans = 0;
    int64_t num = 0;
    REP(i, n) {
        int64_t tmp;
        cin >> tmp;
        if(tmp > 0) {
            num += tmp;
            ans += num / 2;
            num = num % 2;
        } else {
            num = 0;
        }
    }
    cout << ans << endl;
}


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

using namespace std;
static const int MAX = 1000000;
static const int INFTY = (1 << 21);

int n, m;
int d[MAX];
vector<int> list[MAX];
vector<int> ans;

void bfs(int s){
    queue<int> q;
    q.push(s);
    for (int i = 0; i < n+1; i++)
    {
        d[i] = INFTY;
    }
    d[s] = 0;
    int u;
    while(!q.empty()){
        u = q.front();
        q.pop();
        for (int v : list[u])
        {
            if (d[v] != INFTY)
                continue;
            d[v] = d[u] + 1;
            ans[v] = u;
            q.push(v);
        }

    }

}

int main(){
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        list[a].push_back(b);
        list[b].push_back(a);
    }
    ans = vector<int>(n+1,-1);
    bfs(1);
    cout << "Yes" << endl;
    for (int i = 2; i < n+1; i++)
    {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 31752
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  string ans = "No";
  if (S[0] == 'a' && S[1] == 'b' && S[2] == 'c')
    ans = "Yes";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		String input = scan.nextLine();
		String replace = "";
		String m;
		for(int i=0; i<input.length(); i++) {
			if(input.charAt(i) == '1') {
				m = "9";
			} else {
				m = "1";
			}
			replace = replace+m;
		}
		System.out.println(replace);
	}
}

Measured memory_bytes: 21844
object Main {
  def main(args: Array[String]): Unit = {
    io.Source.stdin.getLines().foreach(rec)
  }

  def rec(s: String): Unit = {
    if (check(s)) {
      println(s)
      return
    }

    rec(next(s))

    def check(s: String): Boolean = {
      val list = List("the", "this", "that")
      list.foreach { ss =>
        if (s.contains(ss)) {
          return true
        }
      }
      return false
    }

    def next(s: String): String = {
      val sss = s.map({
        case cc if 'a' to 'z' contains cc => (((cc - 'a' + 1) % 26) + 'a').toChar
        case ch => ch
      })
      sss.toString
    }
  }
}

Measured memory_bytes: 46220
#include <bits/stdc++.h>
using namespace std;
int main(void){

    string a;
    cin >> a ;

    for(int i = 0; i < a.size(); i++){
        if(a.at(i) == ','){
            cout << " " ;
        } else {
            cout << a.at(i);
        }
    }
    cout << endl;

    /*
    if(a - b >= 0){
        cout << b * c + ( a - b ) * d << endl;
    } else {
        cout << a * c << endl;
    }
    */
    
    //cout << b * c + ( a - b ) * d << endl;

    return 0; 
}


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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const int MOD = 1000000007;
const int MAX_N = 100010;

signed main() {
    IOS;

    int N;
    cin >> N;
    N--;
    string ans = "";
    while(N >= 0) {
        int num = N % 26;
        ans += (char)('a' + num);
        N /= 26;
        N--;
    }
    reverse(all(ans));
    print(ans);

    return 0;
}


Measured memory_bytes: 3560
//#include <algorithm>
//#include <cassert>
//#include <cfloat>
//#include <cmath>
//#include <cstdio>
//#include <cstdlib>
//#include <deque>
#include <iostream>
//#include <limits>
//#include <map>
//#include <queue>
//#include <set>
//#include <stack>
//#include <string>
//#include <tuple>
//#include <unordered_map>
//#include <unordered_set>
//#include <vector>
using namespace std;

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

int main() {
  int X; scanf("%d", &X);
  bool judge = X == 3 || X == 5 || X == 7;

  printf("%s\n", judge ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  int ans = 1, ac = 0;
  rep2(i, 1, n+1){
    int t = i;
    int co = 0;
    while(t % 2 == 0 && t > 0){
      t/= 2;
      co++;
    }
    if(ac < co){
      ans = i;
      ac = co;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(void) {
  int n;
  cin >> n;
  long long a[100100];
  for(int i = 0; i < 100100; i++) {
    a[i] = 0;
  }
  long long sum = 0;
  for(int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    a[temp]++;
    sum += temp;
  }
  
  int q;
  cin >> q;
  for(int i = 0; i < q; i++) {
    int b, c;
    cin >> b >> c;
    sum += (c-b)*a[b];
    a[c] += a[b];
    a[b] = 0;
    cout << sum << endl;
  }
  
  return 0;
}

Measured memory_bytes: 4392
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, a[15];
int ans = 1;
int cnt = 1;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ans *= 3;
		if (a[i] % 2 == 0)cnt *= 2;
	}
	cout << ans - cnt << endl;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

int a[1050],b[1050],c[1050][20];

main() {
    int N,M; cin >> N >> M;
    vector<int> dp(5000,INF);
    dp[0]=0;
    rep(i,M) {
        cin >> a[i] >> b[i];
        rep(j,b[i]){
            cin >> c[i][j];
            c[i][j]--;
        }
    }
    rep(i,M){
        int now=0;
        rep(j,b[i]){
            now |= (1<<c[i][j]);
        }
        rep(j,(1 << N)){
            chmin(dp[j | now],dp[j]+a[i]);
        }
    }
    if(dp[(1<<N)-1]==INF) dp[(1<<N)-1]=-1;
    cout << dp[(1<<N)-1] << endl;
}


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

#define ll              long long int
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fast_io         ios_base::sync_with_stdio(false); cin.tie(NULL);


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

    if(n == 0 or m == 0){
    	cout<<"0\n";
    	return 0;
    }

    vector<vector<char>> v(n, vector<char>(m));

    string str;
    for(int i=0; i<n; i++){
    	cin >> str;
    	for(int j=0; j<m; j++){
    		v[i][j] = str[j];
    	}
    }

    vector<vector<ll>> dp(n, vector<ll>(m,0));

    dp[n-1][m-1] = 1;

    for(int i=n-1; i>=0; i--){
    	for(int j=m-1; j>=0; j--){
    		if(i == n-1 and j == m-1){
    			continue;
    		}

    		if(v[i][j] == '#'){
    			dp[i][j] = 0;
    			continue;
    		}

    		if((i+1) < n){
    			dp[i][j] += dp[i+1][j];
    		}

    		if((j+1) < m){
    			dp[i][j] += dp[i][j+1];
    		}

    		dp[i][j] = (dp[i][j]%mod);
    	}
    }
    
    cout<<dp[0][0]<<"\n";
    
	return 0;
}


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

int main(void)
{
    
    int N;
    int K;
    
    cin >> N >> K;
    
    int i;
    int x[N];
    for(i=0;i<N;i++) cin >> x[i];
    
    int l[3];
    l[2] = 0;
    for(i=0;i<N;i++){
        l[0] = 2 * ( fabs( x[i] ) );
        l[1] = 2 * ( fabs( K - x[i] ) );
        if( l[0] <= l[1] ) l[2] = l[2] + l[0];
        else l[2] = l[2] + l[1];
    }
    
    cout << l[2] << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n, z, w;
llong a[2005];
llong mem[2][2005];

llong dfs(llong f, llong x, llong y, llong t) {
    if (t == n) return llabs(x - y);
    if (mem[f][t] != -1) return mem[f][t];
    
    if (f == 0) {
        llong rec = 0;
        for (int i = t; i < n; i++) {
            rec = max(rec, dfs(f ^ 1, a[i], y, i + 1));
        }
        return mem[f][t] = rec;
    }
    else {
        llong rec = 1ll << 60ll;
        for (int i = t; i < n; i++) {
            rec = min(rec, dfs(f ^ 1, x, a[i], i + 1));
        }
        return mem[f][t] = rec;
    }
}

int main() {
    for (int i = 0; i < 2005; i++) {
        mem[0][i] = mem[1][i] = -1;
    }
    
    cin >> n >> z >> w;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    cout << dfs(0, z, w, 0) << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int N,K;
  cin >> N >> K;
  vector<int> A(N);

  //種類を数えるsetを作る=>それぞれの数を数える=>ソートする=>低い順番に減らしていく
  
  for (int i = 0; i < N; i++) {
      cin >> A.at(i);
  }
  

  
  vector<int> num(200000,0);
  
  for (int i = 0; i < N; i++) {
      num.at(A.at(i)) += 1;
  }

  
  sort(num.rbegin(),num.rend());
  int count = 0;
 
  for (int i = K; i < 200000; i++) {
    count += num.at(i);
  }
  
  cout << count << endl;
 
}

Measured memory_bytes: 4768
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>

using namespace std;
typedef long long ll;
typedef double db;
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll a[212345];
ll b[212345];
signed main() {
	ll n, i, t;
	cin >> n;
	for (i = 1; i <= n; ++i)cin >> a[i];
	b[2] = a[1] + a[2];
	for (i = 3; i <= n; ++i) {
		if (i & 1)b[2] -= a[i];
		else b[2] += a[i];
	}
	a[1] -= b[2] / 2, a[2] -= b[2] / 2;
	for (i = 3; i <= n; ++i) {
		b[i] = a[i - 1] * 2;
		a[i] -= a[i - 1];
	}
	b[1] = a[1] + a[n];
	for (i = 1; i <= n; ++i)cout << b[i] << " ";
	cout << endl;
	return 0;
}

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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll x,y;
	cin>>x>>y;
	if(y>x*4 || y&1|| y<x*2)
	    cout<<"No"<<endl;
	 else cout<<"Yes"<<endl;
	    
	return 0;
}

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

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    int d1 = c-a, d2 = d-b;
    swap(d1, d2), d1 *= -1;
    c += d1, d += d2;
    printf("%d %d ", c, d);
    swap(d1, d2), d1 *= -1;
    c += d1, d += d2;
    printf("%d %d ", c, d);
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        s: chars,
    }

    let f = |s: &[char]| -> bool {
        s.iter()
            .all(|&c| "ACGT".chars().find(|&d| d == c).is_some())
    };

    let mut ans = 0;

    for i in 0..s.len() {
        for j in i + 1..s.len() + 1 {
            if f(&s[i..j]) {
                ans = std::cmp::max(ans, j - i);
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''
from itertools import permutations 
N = int(input())
a = list(map(str,input().split()))
a = ''.join(a)
b = list(map(str,input().split()))
b = ''.join(b)
cnt=1
lena = 0
lenb = 0
inp = [ str(i) for i in range(1,N+1)]
inp = ''.join(inp)
perm = permutations(inp)
for i in list(perm):
	temp = ''.join(list(i))
	# print(temp)
	if temp==a:
		lena=cnt
	if temp==b:
		lenb=cnt
	cnt+=1
print(abs(lena-lenb))



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

using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    for(auto& x : a) cin >> x;
    for(auto& x : b) cin >> x;
    ll suma = 0, sumb = 0;
    for(auto& x : a) suma += x;
    for(auto& x : b) sumb += x;

    ll nr_op = sumb - suma;
    if(nr_op < 0){
        cout << "No" << endl;
        return 0;
    }
    ll nr_plus_as = 0, nr_plus_bs = 0;

    for(int i = 0; i < n; ++i){
        if(a[i] > b[i]) nr_plus_bs += a[i] - b[i];
        else if(a[i] < b[i] && (b[i]-a[i])%2ll == 0ll) nr_plus_as += (b[i]-a[i])/2ll;
        else if(a[i] < b[i] && (b[i]-a[i])%2ll == 1ll) nr_plus_as += (b[i]-a[i]+1ll)/2ll, ++nr_plus_bs; }
    if(nr_plus_as > nr_op || nr_plus_bs > nr_op || 2ll * (nr_op-nr_plus_as) != (nr_op - nr_plus_bs)){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<map>
#include<sstream>
#include<vector>
#include<algorithm>
using namespace std;
 
typedef pair<int,string> P;
 
int main(){
  int n;
  char k;
  string s;
  map<string,int> m;
  vector<P> v;
 
  while(cin >> n,n){
    cin.ignore();
    m.clear();
    v.clear();
    for(int i=0;i<n;i++){
      getline(cin,s);
      stringstream ss(s);
      while(ss >> s)m[s]++;
    }
    cin >> k;
 
    for(map<string,int>::iterator it = m.begin();it!=m.end();it++){
      string tmp = (*it).first;
      int hoge = (*it).second;
      if(tmp[0] == k){
    v.push_back(P(-1*hoge,tmp));
    if(v.size()>5){
      sort(v.begin(),v.end());
      v.pop_back();
    }
      }
    }
 
    if(v.empty())cout << "NA\n";
    else{
      sort(v.begin(),v.end());
      for(int i=0;i<(int)v.size()-1;i++)cout << v[i].second << " ";
      cout << v[(int)v.size()-1].second << endl;
    }
  }  
}

Measured memory_bytes: 956
using System;
using System.Linq;

namespace Cs_Tutorial
{
    class Program
    {
        public static void B_Cut_And_Count()
        {
            // 長さ N の入力
            int N = int.Parse(Console.ReadLine());

            // 文字列 S の入力
            string S = Console.ReadLine();

            // ループ
            int max = 0;
            int tmp = 0;

            for (int i = 1; i < N; i++)
            {
                // 文字列の分断
                string X = S.Remove(i);
                string Y = S.Substring(i);

                // Xの分断
                char C = X[0];
                string D = X.Substring(1);

                for (int j = 0; j < X.Length; j++)
                {
                    // CがDに含まれずYに含まれていたら加算
                    if (!(D.Contains(C)) && Y.Contains(C))
                    {
                        tmp += 1;
                    }

                    // C、Dを更新
                    if (D.Length != 0)
                    {
                        C = D[0];
                        D = D.Substring(1);
                    }
                }

                // maxの更新、tmpリセット
                if (max <= tmp)
                {
                    max = tmp;
                }

                tmp = 0;

            }

            // 出力
            Console.WriteLine(max);


        }

        static void Main(string[] args)
        {
            B_Cut_And_Count();
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

int t10[10];
void init() {
	t10[0] = 1;
	rep(i, 9) {
		t10[i + 1] = t10[i] * 10;
	}
}
int a, b, p;


void solve() {
	int dif = b - a+1;
	vector<ll> r(dif + 1, 1);
	rep(i, dif) {
		int x = a + i;

		ll csum = 0;
		string s = to_string(x);
		int tmp = s.length() - 1;
		//cout << x << " " << tmp << endl;
		bool f = false;
		while (x >= a) {
			int d = t10[tmp] - a;
			if (d < 0)d = 0;
			int l = x - a; if (l < 0)l = 0;
			if (f)l++;
			csum += r[l] - r[d] + p;
			//cout << r[l] - r[d] << endl;
			//cout << i << " " << d << endl;
			while (csum >= p)csum -= p;
			x /= 10; tmp--; f = true;
		}
		r[i + 1] += r[i] + csum;
		while (r[i + 1] >= p)r[i + 1] -= p;
	}
	//rep(i, dif+1)cout << r[i] << endl;
	ll ans = r[dif] - 1;
	while (ans < 0)ans += p;
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	init();
	while (cin >> a >> b >> p, a) {
		solve();
	}
	//stop
	return 0;
}


Measured memory_bytes: 4076
#include "bits/stdc++.h"

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll L, R;
int main(){
	ll ans = inf;
	cin >> L >> R;
	REP(i,L,min(L+673, R)+1){
		REP(j,i+1,min(L+673, R)+1){
			ans = min(ans, i * j % 2019);
		}
	}
	p(ans);
	return 0;
}

Measured memory_bytes: 256
import numpy as np
N=int(input())
x=list(input().split())
X = [int(i) for i in x]
X =  np.array(X)
#print(N)
#print(X)

n_max = max(X)
s0 = sum((X)**2)
#print(s0)

for P in range(1,n_max+1):
    #print("P=",P)
    #print((X-P))
    #print((X-P)**2)
    #print(sum((X-P)**2))
    s = sum((X-P)**2)
    if s < s0:
        s0 = s
        P0 = P
print(s0)

Measured memory_bytes: 21800
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String w = sc.next();
		sc.close();
		int[]k = new int[26];
		for(int i = 0; i < w.length(); i++) {
			int t = (int)w.charAt(i) - 'a';
			k[t]++;
		}
		boolean flag = true;
		for(int i = 0; i < 26; i++) {
			if(k[i] % 2 != 0) {
				flag = false;
				break;
			}
		}
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i <= 999; i++) {
        int c[3] = { i/100, (i%100)/10, i%10 };
        int f = 0;
        for (int j = 0; j < n; j++) {
            if (s[j] == ('0' + c[f])) f++;
            if (f == 3) {
                cnt++;
                break;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#pragma warning( disable:4996 )
using namespace std;

#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	/*int a, b;
	scanf("%d %d", &a, &b);
	if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
		printf("%d\n", a * b);
	}
	else {
		printf("-1\n");
	}*/

	int n;
	scanf("%d", &n);
	for (int i = 9; i >= 1; i--) {
		
		if (n % i == 0) {
			if (n / i <= 9) {
				printf("Yes\n");
				return 0;
			}
			else {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        System.out.println(
            new BufferedReader(new InputStreamReader(System.in))
                .lines()  // Stream<String> : each n
                .mapToInt(Integer::parseInt)  // IntStream : each n
                .mapToObj(n -> Stream.of(IntStream.iterate(n - 1, i -> i - 1), IntStream.iterate(n + 1, i -> i + 1))) // Stream<Stream<IntStream>> : [[n-1, n-2, ...], [n+1, n+2, ...]] for each n
                .map(ss -> ss.flatMap(s -> s.filter(x -> IntStream.rangeClosed(2, (int)Math.sqrt(x))
                                                                  .allMatch(y -> x % y != 0))  // prime numbers
                                            .limit(1)  // first one
                                            .mapToObj(String::valueOf))  // Stream<Stream<String>> : 2 prime numbers for each n
                             .collect(Collectors.joining(" ")))  // Stream<String> : output for each n
                .collect(Collectors.joining("\n")));  // String : output for all ns
    }
}

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

int main()
{
  int p[5] {};
  int a, b;
  for (auto i = 0; i < 3; i++) {
    cin >> a >> b;
    p[a]++;
    p[b]++;
  }
  cout << (p[1] < 3 && p[2] < 3 && p[3] < 3 && p[4] < 3 ? "YES" : "NO") << endl;
}


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

#define SLAY ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(0);
#define LL long long
#define PII pair<int , int>
#define PLL pair<long long , long long>
#define INPUT freopen("/Users/amrfahmy/Documents/Problem solving/CF/CF/input.txt", "r", stdin);
using namespace std;
 
const LL MOD = 1000000007;
LL arr[1000000];
LL b[1000];
LL n,q,c,cnt,mx,m,temp,k;
string str;



bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){
    return (a.first < b.first);
}
int gcd(int a, int b) {
   if (b == 0)
      return a;
   return gcd(b, a % b);
}

int main()
{
    bool readfromfile=false; if(!readfromfile){SLAY} else{INPUT}
    
 

    cin>>n>>m;
    //for(int i = 0 ; i < n ; i++)cin>>arr[i];
   
//    if((n==2 && m==3) || (n==3 && m==2 ))cout<<1;
//    if((n==1 && m==2) || ( n==2 && m==1))cout<<3;
//    if((n==1 && m==3) || (n==3 && m==1))cout<<2;
    LL ans =  (n*m)/gcd(n, m);
    printf("%lld",ans);
    return 0;
}
 



Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
//const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}

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






int main() {

	int N;
	string S;
	cin >> N >> S;


	int rindex = 0, lindex = 0;
	
	ll sum = 1;
	for (int i = 0; i < N-1; i++) {


		if (S[i] == S[i + 1]) {
			continue;
		}

		sum += 1;
	}

	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 512
package main

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

func main() {
	sc := NewScanner()
	N, K := sc.NextInt(), sc.NextInt()
	A := sc.NextIntArray()

	a := make([]int, N+1)
	b := make([]int, N+1)
	t := 0
	p := 0
	for i := 0; i < N; i++ {
		a[i] = t
		t += A[i]
		b[i] = p
		p += max(0, A[i])
	}
	a[N] = t
	b[N] = max(0, p)

	mx := 0

	for i := 0; i <= N-K; i++ {
		def := b[N]
		def += -b[i+K] + b[i]
		mx = max(mx, def)
		def += a[i+K] - a[i]
		mx = max(mx, def)
	}
	fmt.Println(mx)

}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 8320
n,m = gets.split.map(&:to_i)
detail = []
m.times do |i|
  detail << gets.chomp.split.map(&:to_i)
  detail[i].push(i,nil)
end

s_det = detail.sort

id = 1
m.times do |i|
  if s_det[i+1] == nil && s_det[i-1][0] == s_det[i][0]
    s_det[i][3] = id
    break
  elsif s_det[i+1] == nil && s_det[i-1][0] != s_det[i][0]
    s_det[i][3] = 1
  elsif s_det[i][0] == s_det[i+1][0]
    s_det[i][3] = id
    id += 1
  else
    s_det[i][3] = id
    id = 1
  end
end

det = s_det.sort_by{|a| a[2]}

det.each do |k|
  puts k[0].to_s.rjust(6,?0) + k[3].to_s.rjust(6,?0)
end

Measured memory_bytes: 31464
n = int(input())
pf = {}

for i in range(2, int(n**0.5) + 1):
    while not n % i:
        pf[i] = pf.get(i, 0) + 1
        n //= i
if n > 1:
    pf[n] = 1
#print(pf)

cnt = 0
for i in pf.values():
    for j in range(1, 50):
        if i - j >= 0:
            cnt += 1
            i -= j
        else:
            break
print(cnt)


Measured memory_bytes: 9448