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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

const int MAX = 1<<20;
LL N, M;
long double num[MAX], prob[MAX];

using LLL = __int128;

LLL gcd(LLL x, LLL y){
  if(y == 0) return x;
  return gcd(y, x%y);
}
LLL lcm(LLL x, LLL y){
  return x / gcd(x, y) * y;
}

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

  cin >> N >> M;
  VL xs(N);
  vector<long double> ps(N);
  REP(i,N)
	cin >> xs[i];
  REP(i,N){
	cin  >> ps[i];
	ps[i] /= 100.;
  }

  FOR(b,1,1<<N){
	LLL l = 1;
	int bc = 0;
	REP(i,N){
	  if(b>>i&1){
		if(l <= M)
		  l = lcm(l, xs[i]);
		++bc;
	  }
	  num[b] = (bc%2*2-1) * M / l;
	}
  }

  for(int i=0;i<N;++i){
	for(int b=0;b<(1<<N);++b){
	  if((b>>i&1) == 1)
		num[b] += num[b^(1<<i)];
	}
  }

  long double ans = 0.;
  REP(b,1<<N){
	prob[b] = 1;
	REP(i,N){
	  prob[b] *= (b>>i&1? ps[i]: 1.-ps[i]);
	}
	ans += prob[b] * num[b];
  }

  cout << fixed << setprecision(9) << ans << endl;
  
  return 0;
}

Measured memory_bytes: 36072
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll ksm(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

const int N=1e5+10;
ll n,k;
ll s[N];
ll ans=0;
int main(){
	scanf("%lld%lld",&n,&k);
	for(ll i=k;i>=1;i--){
		ll x=k/i;
		s[i]+=ksm(x,n);
		for(int j=i+i;j<=k;j+=i){
			s[i]=(s[i]-s[j]+mod)%mod;
		}
		ans=(ans+s[i]*i%mod)%mod;
	}
	printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 4488
using System;

class City
{
    public int i, p, y, b;

    public City(int i, int p, int y)
    {
        this.i = i;
        this.p = p;
        this.y = y;
    }
}

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split(' ');
        var n = int.Parse(nm[0]);
        var m = int.Parse(nm[1]);

        var cities = new City[m];
        for (int i = 0; i < m; i++)
        {
            var py = Console.ReadLine().Split(' ');
            cities[i] = new City(i, int.Parse(py[0]), int.Parse(py[1]));
        }

        Array.Sort(cities, (a, b) => a.p == b.p ? a.y - b.y : a.p - b.p);

        cities[0].b = 1;
        for (int i = 1; i < m; i++)
        {
            if (cities[i - 1].p == cities[i].p)
            {
                cities[i].b = cities[i - 1].b + 1;
            }
            else
            {
                cities[i].b = 1;
            }
        }

        Array.Sort(cities, (a, b) => a.i - b.i);

        for (int i = 0; i < m; i++)
        {
            Console.WriteLine("{0:D6}{1:D6}", cities[i].p, cities[i].b);
        }
    }
}

Measured memory_bytes: 24336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll a, b, c;
  cin >> a >> b >> c;

  ll l = a, r = l % b;
  l += a;
  while (1) {
    if (l % b == c) {
      YES();
      return 0;
    }
    if (l % b == r) {
      NO();
      return 0;
    }
    l += a;
  }
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

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

	final long MODULO = 1_000_000_000 + 7;

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> pq = new PriorityQueue<>(new Comparator<Long>() {
			@Override
			public int compare(Long o1, Long o2) {
				return -Long.compare(o1, o2);
			}
		});
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextLong();
			pq.add(a[i]);
		}
		long ans = 0;
		long w = 0;
		while (pq.peek() + w > n - 1) {
			long v = pq.poll() + w;
			long d = (v - (n - 1) + n - 1) / n;
			ans += d;
			v = v - d * n - w;
			v -= d;
			w += d;
			pq.add(v);
		}
		System.out.println(ans);
	}

	long f(long[] a, long k) {
		int n = a.length;
		long s = 0;
		for (int i = 0; i < n; ++i) {
			if (a[i] + k <= n - 1) {
				continue;
			} else {
				long res = a[i] + k - (n - 1);
				s += (res + n) / (n + 1);
			}
		}
		return k - s;

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 24660
m, d = map(int, input().split(" "))

ans = 0
for i in range(1, m + 1):
    for j in range(22, d + 1):
        x = j % 10
        y = j // 10
        if x >= 2 and y >= 2 and y*x == i:
            ans += 1
print(ans)


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


int main() {
 string S;
 int a = 0;
 cin >> S;
  a = S.size();
  if( S.at(a-1) == 's'){
  S.push_back('e');
  }
    S.push_back('s');
 cout << S << endl;
  return 0;
}


Measured memory_bytes: 3636
N = int(input())
ls = list(map(int, input().split()))
m = 1000000007
sumNum = sum(ls)
currentSum, lastAns = 0, 0
for i in range(N -1):
    currentSum += ls[i]
    lastAns = (lastAns + (ls[i] * (sumNum - currentSum))) % m
print(lastAns)

Measured memory_bytes: 31344
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[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 ) * } } ; }
#[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 , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


#[allow(unused_imports)]
use std::f64;

fn main() {
    input!{k:i64, a:i64, b:i64};
    let c = b - a;
    if c <= 2 { println!("{}", k+1); return(); }
    let k = k - (a - 1);
    //debug!(k,c);

    let mut ans = a;
    //debug!(ans);
    ans += k/2 * c;
    //debug!(ans);
    ans += k%2;

    println!("{}", ans);

}

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

int main(){
	ll n,x; cin >> n >> x;
	vl l(n); rep(i,n)cin >> l[i];
	ll d = 0;
	rep(i,n){
		d += l[i];
		if(d>x){
			cout << i+1 << endl;
			return 0;
		}
	} 
	cout << n+1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define num 1000
int LCS(char x[], char y[])
{
    int m, n, i,  j;
    int c[num + 1][num + 1];
     
    m = strlen(x);
    n = strlen(y);
     
    for (i = 0; i <= m; i++) 
        c[i][0] = 0;
    for (j = 1; j <= n; j++) 
        c[0][j] = 0;
     
    for (i = 1; i <= m; i++){
        for (j = 1; j <= n; j++){
            if (x[i - 1] == y[j - 1]){
                c[i][j] = c[i - 1][j - 1] + 1;
            } else if (c[i - 1][j] >= c[i][j - 1]){
                c[i][j] = c[i - 1][j];
            } else {
                c[i][j] = c[i][j - 1];
            }
        }
    }
    return c[m][n];
}
 
int main()
{
    int n, i;
    char a[num], b[num];
     
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%s", a);
        scanf("%s", b);
        printf("%d\n", LCS(a, b));
    }
    return 0;
}


Measured memory_bytes: 5636
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

import java.util.HashMap;
import java.util.Map.Entry;

@SuppressWarnings("unchecked")
public class Main {
    static final int INF = 1000000007;

    // 素因数分解
    static void primeFactor(HashMap<Integer, Integer> pf, int n) {
        int a = 2;

        // JDK 1.8 Map.merge
        // map value increment
        while (a * a <= n) {
            if (n % a == 0) {
                pf.merge(a, 1, Integer::sum);
                n = n / a;
            } else {
                a++;
            }
        }
        pf.merge(n, 1, Integer::sum);
    }

    // aとbを足した値をmodする(a + b mod p)
    static int modadd(int a, int b) {
        return (a + b) % INF;
    }

    // aとbを掛けた値をmodする(a * b mod p)
    static int modmulti(int a, int b) {
        int res = 0;
        int mod = a % INF;
        while (b > 0) {
            if ((b & 1) == 1) {
                res += mod;
                if (res > INF) {
                    res -= INF;
                }
            }
            mod <<= 1;
            if (mod > INF) {
                mod -= INF;
            }
            b >>= 1;
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        final String s;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            s = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(s);

        HashMap<Integer, Integer> pf = new HashMap<>();

        // 素因数分解 x = p^n * q^m * …
        // 1 は 素数ではない
        for (int i = 2; i <= N; i++) primeFactor(pf, i);

        // N 1 ならば 答えは 1
        int ans = 1;

        // 約数の個数 (n + 1) * (m + 1) * …
        for (Entry<Integer, Integer> en : pf.entrySet()) {
            int val = en.getValue();
            val = modadd(val, 1);
            ans = modmulti(ans, val);
        }

        out.println(ans);

        out.flush();
    }
}


Measured memory_bytes: 25940
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int cost = 0;
	if (a + b > c*2) {
		int Min = min(x, y);
		cost += Min *c*2;
		x -= Min  ;
		y -= Min  ;
		//cout << cost << endl;
		if (x == 0) {
			int co = min(b, c * 2);
			cost += co * y;
		}
		else if (y == 0) {
			int co = min(a, c * 2);
			cost += co * x;
		}
	}
	else {
		cost = a * x + b * y;
	}
	cout << cost << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

const int N = 2e5+5;
vi g[N];
ll vals[N];
int n,q,u,v;

void dfs(int curr, ll val = 0, int par = -1) {
	vals[curr] += val;
	for(auto nxt : g[curr]) {
		if(nxt != par) {
			dfs(nxt, vals[curr], curr);
		}
	}
}

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    memset(vals, 0, sizeof(vals));
    cin>>n>>q;
    FOR(i, 0, n-1) {
    	cin>>u>>v; u--; v--;
    	g[u].push_back(v);
    	g[v].push_back(u);
    }
    FOR(i, 0, q) {
    	cin>>u>>v; u--;
    	vals[u] += v;
    }
    dfs(0);
    FOR(i, 0, n) {
    	cout<<vals[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 24320
#include <iostream>
using namespace std;
int main(){
    int n,ttong,c[1000],t[1000],tmpc=1001,kq=0;
    cin >> n >>ttong;
    for (int i=1;i<=n;i++){
        cin >> c[i] >> t[i];
        if ( (t[i]<=ttong) && (c[i]<tmpc) ) {
            tmpc=c[i];
            kq=i;
        }
    }
    if (kq!=0) cout<<c[kq]; else cout<<"TLE";
}

Measured memory_bytes: 256
n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
flag = False
if max(x_list) < min(y_list):
    flag = True
if flag:
    for i in range(max(x_list) + 1, min(y_list) + 1):
        if x < i <= y:
            flag = True
            break
        else:
            flag = False
if flag:
    print('No War')
else:
    print('War')

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<int> vi;

void solve(){
	
	int n, m; cin >> n >> m;
	if(n%2 == 1){
		for(int i = 0; i < m; ++i){
			cout << i+1 << " " << n-i << "\n";
		}
	}
	else{
		for(int i = 0; i < n/4; ++i){
			if(i == m){
				break;
			}
			cout << i+1 << " " << n-i << "\n";
		}
		for(int i = n/4; i < m; ++i){
			cout << i+1 << " " << n-i-1 << "\n";
		}  
	}
	return;
}

int main(){
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	
	solve();
		
	return 0;
}


Measured memory_bytes: 3652
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (a, b, c) = i.read3::<usize, usize, usize>();
    let ans = if a == b && b == c { "Yes" } else { "No" };
    writeln!(o, "{}", ans).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }
}


Measured memory_bytes: 4352
fun main(args: Array<String>) = yorukatsu6A()

fun yorukatsu6A() {
    val n = readLine()!!.toInt()
    val dList = readLine()!!.split(' ').map { it.toInt() }

    val cSum = IntArray(100001)
    for (i in 0 until n) cSum[dList[i]]++
    for (i in 0 until cSum.lastIndex) cSum[i + 1] += cSum[i]

    val answer = cSum.count { it == n / 2 }

    println(answer)
}


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

struct UnionFind{
    vector<int> par, rank;
    UnionFind(int s) {
        par.resize(s);
        rank.resize(s, 0);
        for(int i = 0; i < s; ++i) par[i] = i;
    }
    int root(int x) {
        return par[x] == x ? x : par[x] = root(par[x]);
    }
    bool same(int x, int y) { return root(x) == root(y); }
    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }
};

const int MAX_N = 100100;
int Friend[MAX_N], Group[MAX_N];
int N, M, K;

int main()
{
    scanf("%d %d %d", &N, &M, &K);
    UnionFind List(MAX_N);
    for(int i = 0; i < M; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        --a, --b;
        List.unite(a,b);
        ++Friend[a], ++Friend[b];
    }
    for(int i = 0; i < N; ++i) {
        ++Group[List.root(i)];
    }
    for(int i = 0; i < N; ++i) {
        Group[i] = Group[List.root(i)];
    }
    for(int i = 0; i < K; ++i) {
        int c, d;
        scanf("%d %d", &c, &d);
        --c, --d;
        if(List.same(c,d)) {
            ++Friend[c], ++Friend[d];
        }
    }
    for(int i = 0; i < N; ++i) {
        printf("%d ", Group[i] - 1 - Friend[i]);
    }
    printf("\n");
    return 0;
}

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


int main() {
  
  int H,W;
  cin  >> H >> W;
  
  string S;
  string T;
  
  for(int j; j<W+2; j++)T+=".";
  
  for(int i; i<H; i++){
    T += ".";
    cin >> S;
    T += S;
    T += ".";
  }
  
  for(int j; j<W+2; j++)T+=".";  
  
  rep(i, H){
    rep(j, W){
      
      int num =0;
      
      if(T.at((W+2)*(i+1)+j+1)=='#')
        cout << "#";
      
      else if(T.at((W+2)*(i+1)+j+1)=='.'){
        rep(k,3){
          rep(l,3){
            if(T.at((W+2)*(i+ k)+j+ l)=='#')
              
              num++;
          }
        }
    
        cout << num;
      }
      
    }
    cout << endl;
  }
  
  
  
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
int dp[100005], a[100005], n;
int LIS() {
  int len = 1;dp[0] = a[0];
  for (int i = 1; i < n; ++i) {
    if (a[i] >= dp[len - 1]) dp[len++] = a[i];
    else *upper_bound(dp, dp + len, a[i]) = a[i];
  }return len;
}
int main() {
  cin >> n;
  for (int i = n - 1; i >= 0; i--) cin >> a[i];
  cout << LIS() << endl;
}

Measured memory_bytes: 4316
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int ans=0;
	for(int i=a;i<=b;i++)
	{
		int sum=0,temp=i;
		while(temp!=0)
		{
			sum++;
			temp/=10;
		}
		int c[sum];
		temp=i;
		int p=sum-1;
		while(temp!=0)
		{
			c[p]=temp%10;
			temp/=10;
			p--;
		}
		p=sum-1;
		bool huiwenshu=true;
		for(int i=0;i<=sum/2-1;i++)
		{
			if(c[i]!=c[p])
			{
				huiwenshu=false;
				break;
			}
			p--;
		}
		if(huiwenshu==true)
		{
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <queue>
#include <string.h>
using namespace std;
map <string, int> dp;
map <string, int>::iterator it;
void bfs();
int dx[5];

int main()
{
    dx[0] = 1;
    dx[1] = -1;
    dx[2] = 4;
    dx[3] = -4;
    bfs();
    string s;
    while(getline(cin, s))
    {
        s.erase(remove(s.begin(), s.end(), ' '), s.end());
        printf("%d\n", dp[s]);
    }
    return 0;
}

void bfs()
{
    queue <string> q;
    q.push("01234567");
    dp["01234567"] = 0;
    while(!q.empty())
    {
        int p;
        string now = q.front();
        q.pop();
        int i;
        for(i = 0; now[i]; i++)
            if(now[i] == '0')
            {
                p = i;
                break;
            }
        for(i = 0; i < 4; i++)
        {
            int nx;
            nx = p + dx[i];
            if(p == 3 && nx == 4 || p == 4 && nx == 3 || nx < 0 || nx > 7)
                continue;
            string nx_s = now;
            swap(nx_s[nx], nx_s[p]);
            it = dp.find(nx_s);
            if(it == dp.end())
            {
                q.push(nx_s);
                dp[nx_s] = dp[now] + 1;
            }
        }
    }
    return ;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
ll a[112345];
int main()
{
//	freopen("B.in","r",stdin);
//	freopen(".out","w",stdout);
	ll n=read();
	For(i,n) scanf("%lld",&a[i]);
	ll L=2,R=2;
	ForD(i,n){
		ll p=a[i];
		if(L%p) L+=p-L%p;
		if(R%p) R-=R%p;
		if (L>R) puts("-1"),exit(0);
		R+=a[i]-1;
	}
	cout<<L<<' '<<R<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <set>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    set<int> st;
    for(int i = 0; i < n; i++)
    {
        int x; cin >> x;
        st.insert(x);
    }
    if(n == (int)st.size())
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 9600
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void){
  
  int t,top=0,x[100];
  char a[99];
  
  while( scanf("%s",a) != EOF ){
    
    if(a[0] == '+'){
      x[top-2] = x[top-2] + x[top-1];
      top--;
    }
    
    else if(a[0] == '-'){
      x[top-2] = x[top-2] - x[top-1];
      top--;
    }
    
    else if(a[0] == '*'){
      x[top-2] = x[top-2] * x[top-1];
      top--;
    }

    else{
      t = atoi(a);
      x[top]=t;
      top++;
    }

  }
    printf("%d\n",x[0]);
      return 0;


}

Measured memory_bytes: 548
#include <iostream>

using namespace std;

void selectionSort(int A[], int N) {
	int cnt = 0;
	for (int i = 0; i <= N - 1; i++) {
		bool flag = false;
		int minj = i;
			for (int j = i; j <= N - 1; j++) {
				if (A[j] < A[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag) {
				int v = A[minj];
				A[minj] = A[i];
				A[i] = v;
				cnt++;
			}
			
	}
	for (int i = 0; i < N; i++) {
		if (i == N - 1) {
			cout << A[i] << endl;
			break;
		}
		cout << A[i] << " ";
	}
	cout << cnt << endl;
}


int main() {
	int N;
	int A[100];
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	selectionSort(A, N);
	return 0;
}


Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
  let s: String = read();
  let q: i32 = read();
  let mut rev : bool = false;
  let mut head: String = "".to_string();
  let mut tail: String = "".to_string();
//  println!("s={:?} q={:?}", s, q);
  for _i in 0..q {
    let t: i32 = read();
    if t == 1 {
      rev = !rev;
//      println!("t={:?}", t);
//      s = s.chars().rev().collect();
    } else if t == 2 {
      let f: i32 = read();
      let c: String = read();
//      println!("t={:?}, f={:?}, c={:?}", t, f, c);
      if f == 1 {
//        s = format!("{}{}", c, s);
        if !rev {
          head = format!("{}{}", head, c);
//          s = format!("{}{}", c, s);
        }
        else {
          tail = format!("{}{}", tail, c);
//          s = format!("{}{}", s, c);
        }
      }
      else if f == 2 {
        if !rev {
//          s = format!("{}{}", s, c);
          tail = format!("{}{}", tail, c);
        }
        else {
//          s = format!("{}{}", c, s);
          head = format!("{}{}", head, c);
        }
      }
      else {
        panic!("f is not 1 and 2");
      }
    }
    else {
      panic!("illegal input");
    }
  }
  if !rev {
    println!("{}{}{}", head.chars().rev().collect::<String>(), s, tail)
  }
  else {
    println!("{}{}{}", tail.chars().rev().collect::<String>(), s.chars().rev().collect::<String>(), head);
  }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

using ll = long long;
const ll mod = LLONG_MAX;


ll a,b,x;
int main(){
  cin>>a>>b>>x;

  if(a%x!=0)a=a+(x-a%x);

  if(b-a<0){
    cout<<0<<endl;
    return 0;
  }else if(b-a==0){
    cout<<1<<endl;
    return 0;
  }

  ll ans=((b-a)/x)+1;
  cout<<ans<<endl;

}


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

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


Measured memory_bytes: 2120
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;

class Program
 {
        static void Main(string[] args)
        {
          //入力を受け取る
          int n = int.Parse(Console.ReadLine());
          string[] A = Console.ReadLine().Split(' ');
          string[] B = Console.ReadLine().Split(' ');
          string[] C = Console.ReadLine().Split(' ');          
          int sum = 0;
          for (int i = 0; i < n-1; i++){
            if(int.Parse(A[i])+1 == int.Parse(A[i+1]))
            sum += int.Parse(C[int.Parse(A[i])-1]);
          }
          for (int i = 0; i < n; i++)  sum += int.Parse(B[i]);

          System.Console.WriteLine(sum);
        }
 }

Measured memory_bytes: 11092
#include <iostream>
#include <stdlib.h>
using namespace std;

int main() {
	int n,m;
	int k[150]={};
	int x[150][10]={};
	int s[150][10]={};
	int mr[150][10][77]={};
	int r,ar;
	while(1){
		cin >> n >> m;
		if(n==0){return 0;}
		for(int i=0;i<n;i++){
			cin >> k[i];
			for(int j=0;j<k[i];j++){
				cin >> x[i][j] >> s[i][j];
			}
		}
		for(int i=0;i<k[n-1];i++){
			mr[n-1][i][0]=0;
			mr[n-1][i][1]=0;
		}
		for(int i=0;i<k[n-2];i++){
			mr[n-2][i][0]=0;
		}
		for(int i=n-2;i>=0;i--){
			//cout << "i "<< i << endl;
			for(int am=max(0,m-(i+1)/2);am<=(n-i)/2 && am<=m && !(i==n-2 && am==1);am++){
				// << "am " << am << " ";
				for(int j=0;j<k[i];j++){
					mr[i][j][am]=-1;
					for(int l=0;l<k[i+1];l++){
						int am2=min(am,(n-i-1)/2);
						r=mr[i+1][l][am2]+(s[i][j]+s[i+1][l])*abs(x[i][j]-x[i+1][l]);
						if(mr[i+1][l][am2]>=0 && (r<mr[i][j][am] || mr[i][j][am]==-1)){
							mr[i][j][am]=r;
						}
					}
					if(am>0){
						for(int l=0;l<k[i+2];l++){
							//if(mr[i+2][l][am-1]==0){cout <<"i:"<<i <<" j:"<< j << " l:"<<l<<" am:"<<am <<endl;}
							r=mr[i+2][l][am-1]+(s[i][j]+s[i+2][l])*abs(x[i][j]-x[i+2][l]);
							if(mr[i+2][l][am-1]>=0 && (r<mr[i][j][am] || mr[i][j][am]==-1)){
								mr[i][j][am]=r;
							}
						}
					}
					//cout << "i:" << i << " j:" << j << " am:" <<am << " mr:" << mr[i][j][am] << endl;
				//cout << " "<<mr[i][j][am] ;
				}
			//cout << endl;
			}
		}
		int mar=-1;
		for(int i=0;i<k[0];i++){
			ar=mr[0][i][m];
			if(ar < mar || mar==-1){
				mar=ar;
			}
		}
		if(m>1){
			for(int i=0;i<k[1];i++){
				ar=mr[1][i][m-1];
				if(ar < mar|| mar==-1){
					mar=ar;
				}
			}
		}
		cout << mar << endl;
	}
}

Measured memory_bytes: 1628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int n; cin >> n;
    bool can = false;
    FOR(i,1,10){
        FOR(j,1,10){
            if(n == (i*j)) can = true;
        }
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
//#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 998244353
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    int res = 1;

    x = x;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)%M;

        y = y>>1;
        x = (x*x)%M;
    }
    return res%M;
}
bool isprime(int x)
{
      if(x<2)
        return false;
    for(int i=2;i*i<=x;i++)
     {
        if (x%i==0)
            return false;
    }
    return true;
}
vector<int>primeFactors(int n)
{
    vector<int>v;
    int x=0;
    while (n % 2 == 0)
    {
        x++;
        n = n/2;
        v.pb(2);
    }
    //if(x>0)
    //v.pb({2,x});
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        int y=0;
        while (n % i == 0)
        {
            y++;
            n = n/i;
            v.pb(i);
        }
        //if(y>0)
        //v.pb({i,y});
    }
    if (n > 2)
        v.pb(n);
    return v;
}
int maxSubArraySum(int a[], int size)
{
    int max_so_far = INT_MIN, max_ending_here = 0;

    for (int i = 0; i < size; i++)
    {
        max_ending_here = max_ending_here + a[i];
        if (max_so_far < max_ending_here)
            max_so_far = max_ending_here;

        if (max_ending_here < 0)
            max_ending_here = 0;
    }
    return max_so_far;
}

void solve()
{
int n;
cin>>n;
vector<int>v=primeFactors(n);
map<int,int>m;
for(int i=0;i<v.size();i++)
{
    m[v[i]]++;
}
int ans=0;
for(auto it=m.begin();it!=m.end();it++)
{
    int x=it->second;
    int c=1;
    int k=0;
    while(x>=c)
    {
        x-=c;
        c++;
        k++;
    }
    ans+=k;
}
cout<<ans<<endl;
}
signed main()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
//cin>>t;
t=1;
while(t--)
{

solve();

}
}


Measured memory_bytes: 3688
# ABC068C - Cat Snuke and a Voyage (ARC079C)
def main():
    N, M = tuple(map(int, input().split()))
    A = tuple(tuple(map(int, input().split())) for _ in range(M))
    S, D = set(), set()  # start, destination
    for a, b in A:
        if a == 1:
            S |= {b}
        if b == N:
            D |= {a}
    flg = S & D  # if the same X in both S & D -> possible
    print("POSSIBLE" if flg else "IMPOSSIBLE")


if __name__ == "__main__":
    main()

Measured memory_bytes: 37224
const main = stdin => {
  const input = stdin.trim().split('\n')

  const [N, M, X, Y] = input[0].split(' ').map(x => parseInt(x))

  const xs = input[1].split(' ').map(x => parseInt(x))
  const ys = input[2].split(' ').map(x => parseInt(x))

  let xMax = -99999
  for (let i = 0; i < N; i++) {
    if (xs[i] > X && xs[i] > xMax) {
      xMax = xs[i]
    }
  }

  let yMin = 99999
  for (let i = 0; i < N; i++) {
    if (ys[i] <= Y && ys[i] <= yMin) {
      yMin = ys[i]
    }
  }

  if (xMax !== -99999 && yMin !== 99999 && xMax < yMin) {
    console.log('No War')
  } else {
    console.log('War')
  }
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 30580
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define int lint
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
vector<pair<lint, lint>> primeFactorize(lint N)
{
    vector<pair<lint, lint>> res;
    for (lint a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        lint ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1)
        res.push_back({N, 1});
    return res;
}
signed main()
{
    int n;
    cin >> n;
    int ans = 0;
    auto res = primeFactorize(n);
    for (auto p : res)
    {
        for (int i = 1;; i++)
        {
            if (p.second >= i)
            {
                ans++;
                p.second -= i;
            }
            else
            {
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
N, M = map(int, input().split())
L = []
R = []
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
ans = min(R) - max(L) + 1
if ans < 0:
    ans = 0
print(ans)

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

int main(void){
  int D, G;
  vector<int> p, c;
  cin >> D >> G;
  p.resize(D);
  c.resize(D);

  for (int i = 0; i < D;i++){
    cin >> p[i] >> c[i];
  }

  // アプローチ
  // 最も点数の高い問題から順に解いた場合の問題数を取得し,
  // そこにそれぞれのコンプリートボーナスがあった場合と比較する
  // 2^D
  int score = 0;
  int min = -1;
  int maxApproach = 1;
  for (int i = 0; i < D;i++){
    maxApproach *= 2;
  }

  for (int i = 0; i < maxApproach;i++){
    int score = G;
    int count = 0;
    vector<int> completeIndexList;
    int pow = 1;
    for (int j = 0; j < D;j++){
      pow *= 2;
      if(i%pow>=pow/2){
        completeIndexList.push_back(j);
      }
    }
    // for (auto val: completeIndex){
    //   cout << val << ",";
    // }
    // cout << endl;

    // コンプリートを前提とした箇所のスコアと問題数を加算する
    for(auto index : completeIndexList){
      score -= (p[index] * (index + 1) * 100 + c[index]);
      count += p[index];
    }
    // コンプリートしていない得点の問題を,点数が高い順に解いていく
    for (int j = D - 1; j >= 0;j--){
      // 既に目標スコアを満たしていれば終了
      if(score<0){
        break;
      }

      bool isCompleted = false;
      for(auto index : completeIndexList){
        if(j==index){
          isCompleted = true;
        }
      }
      if(isCompleted==true){
        continue;
      }

      int solveCount = score / (100 * (j + 1));
      if(solveCount>p[j]){
        solveCount = p[j];
      }
      score -= solveCount * (100 * (j + 1));
      count += solveCount;
      if (solveCount == p[j]){
        // コンプリートボーナスを加算
        score -= c[j];
      }
    }
    // 現在の施行における回答数
    // cout << count << endl;
    if(min==-1 || min>count){
      min = count;
    }
  }

  // 結果を表示
  cout << min << endl;
}


Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
V = defaultdict(list)

for _ in range(N-1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

def dfs(source):
    dist = [-1]*(N+1)
    dist[source] = 0
    q = [source]
    while q:
        a = q.pop()
        for b in V[a]:
            if dist[b]!=-1:continue
            dist[b] = dist[a] + 1
            q.append(b)
    return dist

d1, d2 = dfs(1), dfs(N)
a = sum(d1[i]<=d2[i] for i in range(1, N+1))
print("Fennec" if 2*a>N else "Snuke")


Measured memory_bytes: 68456
n = int(input())
a = list(map(int,input().split()))
cum = sum(a)
d = n*(n+1)//2
if cum%d:
    print("NO")
else:
    x = cum//d
    if min(a) < x and max(a) > n*x:
        print("NO")
        exit()
    a.append(a[0])
    count = 0
    for i in range(n):
        dif = a[i+1]-a[i]
        if (x-dif)%n or x-dif < 0:
            print("NO")
            exit()
        count += (x-dif)//n
    if count <= x:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 20404
#include <stdio.h>

#define N 1000

int main(){
  int n, i, j, k, key;
  int A[N];
  scanf("%d", &n);

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

  for (i = 0; i < n; i++) {
    key = A[i];
    j = i - 1;
    while (j >= 0 && A[j] > key) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    for (k = 0; k < n; k++) {
      if (k > 0){
        printf(" ");
      }
      printf("%d",A[k]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 608
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int n = 0;
		int kazu = 0;
		for(int i= a;i<=b;i++){
			if (c%i == 0){
				kazu += 1;
			}
		}
		System.out.println(kazu);
	}
}

Measured memory_bytes: 26292
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a;
  string b;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b;
    if(b=="Y"){
      cout<<"Four"<<endl;
      return 0;
    }
  }
  cout<<"Three"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
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; }

struct UnionFind{
  // 小さい方を大きいほうにくっつける
  // これのおかげでO(logN)になる
  // 親をたどる際に途中経路に結果を残しておくことで根に直接葉をつなげる
  vector<int> d;
  UnionFind(int n=0):d(n,-1){}
  int find(int x){
    // 根を返すfind関数
    // d[x] < 0 -> xは根
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x,int y){
    x = find(x); y = find(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x,int y){return find(x) == find(y);}
  int size(int x){return -d[find(x)];}
};

signed main(){
  int n,m;
  cin >> n >> m;
  vector<int> A(n);
  rep(i,0,n) cin >> A[i];
  UnionFind tree(n+1);
  rep(i,0,m){
    int x,y;
    cin >> x >> y;
    tree.unite(x,y);
  }
  int res = 0;
  rep(i,0,n){
    if(A[i] == i+1) res++;
    else{
      if(tree.same(A[i],i+1)) res++;
    } 
  }
  cout << res << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
    int a,b,c,n=0,count=0;
    scanf("%d %d %d\n",&a,&b,&c);
   
    for(n=a;n<=b;n++){
        if(c%n==0){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
    
}



Measured memory_bytes: 2136
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int cmp(const void *a, const void *b);
//your code here!

int main(void){
    ll _7=0, _5=0, A;
    rep(i, 0, 3){
        scanf("%lld", &A);
        if(A==5) _5++;
        if(A==7) _7++;
    }
    if(_7==1 && _5==2)printf("YES\n");
    else printf("NO\n");
    return 0;
}

int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート
}


Measured memory_bytes: 128
s = input()
t = input()
max_count = 0

for i in range(len(s)-len(t)+1):
    count = 0
    s_ = s[i:i+len(t)+1]
    for j in range(len(t)):
        if s_[j] == t[j]:
            count += 1
    max_count = max(max_count, count)

print(len(t) - max_count)

Measured memory_bytes: 9116
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
using namespace std;

typedef long long ll;
const ll mod=1e9+7;
const int M=1e5+10;
int a[M],b[M];

ll poww(int a,int b){
    ll ans=1;
    ll aa=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*aa)%mod;
        aa=(aa*aa)%mod;
        b>>=1;
    }
    return ans;
}

/**/int comp(int *a,int *b,int n){
    if(a[0]<b[0])
        return 1;
    else
        if(a[0]>b[0])
        return -1;
    else
        if(n==1)
        return 0;
    else
        return comp(a+1,b+1,n-1);
}

int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        int flag=0;
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        sort(a,a+n);
        if(n%2){
            b[0]=0;
            for(int i=1;i<n;i+=2){
                b[i]=i+1;
                b[i+1]=i+1;
            }

        }
        else
            for(int i=0;i<n;i+=2){
                b[i]=b[i+1]=i+1;
            }
        if(comp(a,b,n)!=0)
            printf("0\n");
        else{
            ll ans=poww(2,n/2);
            printf("%I64d\n",ans);
        }
    }
    return 0;
}


Measured memory_bytes: 1024
n=int(input())
A=[]
L=[]
for i in range(n):
   a=int(input())
   A.append(a)
   D=[]
   for j in range(a):
      x,y=map(int,input().split())
      D.append((x,y))
   L.append(D)

ans=0
for i in range(2**n):
   B=[0]*n
   for j in range(n):
      if i>>j&1:
         B[j]=1
   if 1 in B:
      flag=True
      for k in range(n):
         if B[k]==1:
            for m in range(A[k]):
               if B[L[k][m][0]-1]!=L[k][m][1]:
                  flag=False
                  break
      if flag:
         ans=max(ans,sum(B))
print(ans)


Measured memory_bytes: 46828
ipt = [int(input()) for i in range(4)]

def main():
    a = ipt[0] ## number of 500 yen
    b = ipt[1] ## number of 100 yen
    c = ipt[2] ## number of  50 yen
    x = ipt[3] ## pay x yen exactly

    cnt = 0;

    for ai in range(0, a + 1):
        for bi in range(0, b + 1):
            for ci in range(0, c + 1):
                if (amount(ai, bi, ci) == x):
                    cnt += 1
                    ## For debuging
                    ## print(ai, bi, ci, cnt)
                else:
                    ## For debuging
                    ## print(ai, bi, ci, cnt)
                    pass

    print(cnt)

def amount(a, b, c):
    return  (  (500 * a)
             + (100 * b)
             + ( 50 * c))

main()

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;
use std::iter::*;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

macro_rules! rotate {
    ($a: expr, $b: expr, $c: expr, $d: expr) => {{
        let t = $a;
        $a = $b;
        $b = $c;
        $c = $d;
        $d = t;
    }}
}

use std::collections::BTreeMap;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let mut u: u32 = sc.read();
    let mut s: u32 = sc.read();
    let mut e: u32 = sc.read();
    let mut w: u32 = sc.read();
    let mut n: u32 = sc.read();
    let mut d: u32 = sc.read();

    let mut map = BTreeMap::<(u32, u32), u32>::new();

    for k in 0..6 {
        for _ in 0..4 {
            map.insert((u, s), e);
            rotate!(n, e, s, w);
        }
        if k % 2 == 0 {
            rotate!(u, n, d, s);
        } else {
            rotate!(u, w, d, e);
        }
    }

    let m = sc.read();
    for _ in 0..m {
        let u: u32 = sc.read();
        let s: u32 = sc.read();
        println!("{}", map.get(&(u, s)).unwrap());
    }
}



Measured memory_bytes: 5052