akhauriyash/Code-Regression huggingface dataset:
from collections import Counter

N = int(input())
THE_NUMBER = 10**9 + 7

prime_number_counter = Counter()

# factorial sequence.
for current_factorial_number in range(2, N + 1):
  # prime number calculation.
  cfn_holder = current_factorial_number
  for candidate_prime_number in range(2, current_factorial_number + 1):
    while cfn_holder % candidate_prime_number == 0:
      cfn_holder /= candidate_prime_number
      prime_number_counter[candidate_prime_number] += 1

ans = 1
for prime_number_count in prime_number_counter.values():
  ans *= prime_number_count + 1

print(ans % THE_NUMBER)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

const int INF = 1001001001;
vector<int> to[100005];

int main() {
	int N, M;
	cin >> N >> M;
	int X, Y;
	
	rep (i, M) {
		cin >> X >> Y;
		--X; --Y;
		to[X].push_back(Y);
		to[Y].push_back(X);
	}

	vector<int> prev(N,-1);
	vector<int> dist(N, INF);
	queue<int> que;
	dist[0] = 0;
	que.push(0);
	while(!que.empty()){
		int point = que.front();
		que.pop();
		for(int u : to[point]){
			if(dist[u] != INF) continue;
			dist[u] = dist[point] + 1;
			prev[u] = point; 
			que.push(u);
		}
	}

	int count = 0;
	rep(i, N){
		if(prev[i] == -1){
			count++;
		}
	}
	
	if(count == 1){
		cout << "Yes" << endl;
		rep(i, N - 1){
			cout << prev[i + 1]+1 << endl;
		}
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

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

int main() {
  int a,n;
  cin>>a>>n;
  vector<int> c(n);
  int sum=0;
  for (int i=0;i<n;++i) {
    cin>>c[i];
    sum+=c[i];
  }
  if (sum>=a) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
}



Measured memory_bytes: 640
//JSD
#include<iostream>
#include<vector>
#include<set>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<limits.h>
#define ll long long 
using namespace std;
ll lastDig(ll x){
	return x%10;
}
ll firstDig(ll x){
	ll p=0;
	while(x>0){
		p=x%10;
		x/=10;		
	}
	return p;
}
int main(){
	ll n,ans=0;;
	cin>>n;
	map<pair<ll,ll>,ll> m;
	for(int i=1;i<=n;i++){
		ll f=firstDig(i),l=lastDig(i);		
		if(i<10){
			f=i,l=i;
		}			
		m[{l,f}]++;				
	}	
	for(int i=0;i<=9;i++){
		for(int j=0;j<=9;j++)
			ans+=(m[{i,j}]*m[{j,i}]);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
use std::cmp::min;
use std::collections::HashSet;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let k: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut set = HashSet::new();

    for i in 0..s.len() {
        for j in i..min(s.len(), i + k) {
            set.insert(&s[i..j + 1]);
        }
    }

    let mut v: Vec<&str> = set.into_iter().collect();
    v.sort();
    let ans = v[k - 1];
    println!("{}", ans);
}


Measured memory_bytes: 6396
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    /*rlimit rlim;
    if (getrlimit(RLIMIT_STACK, &rlim)) return 1;
    rlim.rlim_cur = rlim.rlim_max;
    if (setrlimit(RLIMIT_STACK, &rlim)) return 2;*/
    ll x=llabs(nxt()),k=nxt(),d=nxt();
    ll temp=(x/d);
    if(temp>=k)
    {
        cout<<x-k*d<<endl;
        exit(0);
    }
    k-=temp;
    x=x-temp*d;
    if(k%2==0)
        cout<<x<<endl;
    else
    {
        cout<<min(llabs(x+d),llabs(x-d))<<endl;
    }
    
	printclock;
	return 0;
}

Measured memory_bytes: 3808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int x,y,z;
		
		if (a<b){
			x = b-a;
		}
		else {
			x = a-b;
		}
		
		if (b<c){
			y = c-b;
		}
		else {
			y = b-c;
		}
		
		if (a<c){
			z = c-a;
		}
		else {
			z = a-c;
		}
		
		if (z <= d){
//			System.out.println("1");
			System.out.println("Yes");
			return;
		}
		
		if ((x<=d) && (y<=d)){
//			System.out.println("2");
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
		
	}

}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  vt<int> x(4), y(4);
  rep(i,2)
    std::cin >> x[i] >> y[i];

  int a = x[1] - x[0];
  int b = y[1] - y[0];
  x[2] = x[1] - b;
  y[2] = y[1] + a;
  x[3] = x[2] - a;
  y[3] = y[2] - b;
  std::cout << x[2] << ' ' << y[2] << ' ' << x[3] << ' ' << y[3] << '\n';
  return 0;
}


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

int main(){

    rep(i, 5){
        int x;
        cin >> x;
        if (x == 0) cout << i+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3608
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a + b == 3{
		fmt.Println(3)
	}else if a + b == 4{
		fmt.Println(2)
	}else if a + b == 5{
		fmt.Println(1)
	}else{
		fmt.Println("error")
	}
}

Measured memory_bytes: 1832
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
long long int dp[300020] = {};
int main() {
	long long int n, x;
	cin >> x >> n;
	long long int p, b;
	long long int pathi[52] = {};
	long long int bured[52] = {};
	long long int sum[52] = {};
	pathi[0] = 1;
	bured[0] = 0;
	sum[0] = pathi[0] + bured[0];
	for (int i = 1; i <= 50; i++) {
		pathi[i] = pathi[i - 1] * 2 + 1;
		bured[i] = bured[i - 1] * 2 + 2;
		sum[i] = pathi[i] + bured[i];
	}
	long long int ansb = 0;
	long long int ansp = 0;
	while (n > 0) {
		if (x == 0) {
			ansp = ansp + 1;
			break;
		}
		if (sum[x] == n) {
			ansp = ansp + pathi[x];
			ansb = ansb + bured[x];
			break;
		}
		n = n - 1;
		ansb = ansb + 1;
		if (n == sum[x-1]) {
			ansp = ansp + pathi[x - 1];
			ansb = ansb + bured[x - 1];
			break;
		}else if (n > sum[x - 1]) {
			n = n - sum[x - 1] - 1;
			ansp = ansp + 1 + pathi[x - 1];
			ansb = ansb + bured[x - 1];
		}
		x = x - 1;
	}
	cout << ansp;
}

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

        public class Program
        {
            public static void Main(string[] args)
            {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int answer = 0;

            for(int i = input[0]; i <= input[1]; i++)
            {
                string stock ="";
                
                for(int j = i.ToString().Length - 1; 0 <= j; j--)
                {
                    stock += i.ToString().Substring(j, 1);
                }

                if(int.Parse(stock) == i)
                {
                    answer++;
                }
            }

            Console.WriteLine(answer);
            }
        }

Measured memory_bytes: 15432
line = [int(x) for x in input().strip().split()]

N = line[0]
X = line[1]


patties = [1]
buns = [0]
layers = [1]
for i in range(1, 51):
	patties.append(patties[i - 1] * 2 + 1)
	buns.append(buns[i - 1] * 2 + 2)
	layers.append(patties[i] + buns[i])

def answer(l, r, level):
	if (l > r):
		return 0
	if (l == 1 and r == layers[level]):
		return patties[level]

	mid = layers[level] // 2 + 1
	ans = 0
	if (r > mid):
		ans += 1
		ans += answer(1, layers[level - 1], level - 1)
		ans += answer(1, r - mid, level - 1)
	elif (r == mid):
		ans += 1
		ans += answer(1, layers[level - 1], level - 1)
	else:
		ans += answer(1, r - 1, level - 1)
	return ans

print(answer(1, X, N))

Measured memory_bytes: 3064
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 110, MOD = 1e9 + 7;

bool mark[MAXN];

int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int javab = -1, x, n, in;
	cin >> x >> n;
	for(int i = 0; i < n; i++){
		cin >> in;
		mark[in] = 1;
	}
	int ans = x + 1;
	for(int i = 0; i < MAXN; i++){
		if(!mark[i]){
			if(abs(i - x) < ans){
				javab = i;
				ans = abs(i - x);
			}
		}
	}
	cout << javab << '\n';
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    cout<<max(0,a-2*b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int n;
  while(cin >> n,n) {
    int v[n];
    REP(i,n)
      cin >> v[i];
    int res = 0;
    REP(i,n) {
      REP(j,n-i-1) {
        if (v[j] > v[j+1]) {
          //  printf("%d,%d, %d,%d\n",i,j,v[j],v[j+1]);
          swap(v[j],v[j+1]);
          res++;
        }
      }
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;	

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string a;
	cin >> a;
	sort(a.begin(),a.end());
	if (a[0] == a[1] && a[2] == a[3] && a[0] != a[2]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys 

w = sys.stdin.readline()
count = [0]*26

for i in w:
    if ord(i) in range(ord('a'),ord('z')+1):
        count[ord(i)-ord('a')] = count[ord(i)-ord('a')] + 1           

for i in count:
    if i%2 != 0:
        print 'No'
        sys.exit(0)
print 'Yes'

Measured memory_bytes: 2568
N=int(input())
if N==0:
  print(2)
elif N==1:
  print(1)
else:
  dp=[0]*(N+1)
  dp[0]=2
  dp[1]=1
  for i in range(2,N+1):
    dp[i]=dp[i-1]+dp[i-2]
  print(dp[N])


Measured memory_bytes: 3060
#include <stdio.h>
int main(void)
{
	int N,ans;
	scanf("%d",&N);
	if(N < 10){
		ans = N;
	} else if(N < 100) {
		ans = 9;
	} else if(N < 1000) {
		ans = 9 + N - 99;
	} else if(N < 10000) {
		ans = 9 + 900 ;
	} else if(N < 100000){
		ans = 909 + N -  9999;
	} else {
		ans = 90909;
	}
	printf("%d",ans);
	return 0;

}

Measured memory_bytes: 128
#include "iostream"
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    
    string result;
    for(int i=0;i<n;i++)
    {
        result=result + s[i] +t[i];
        
    }

    cout<<result<<endl;
    
    
    
    
}


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

using namespace std;

using Weight = long long;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int _s, int _d, Weight _w) : src(_s), dst(_d), weight(_w) {}
    Edge() {}
};
bool operator<(const Edge &e1, const Edge &e2) {
    return e1.weight > e2.weight;
}
using Graph = vector<vector<Edge>>;

void Dijkstra(const Graph &g, int s) {
    const int n = g.size();
    const Weight INF = numeric_limits<Weight>::max() / 8;
    vector<Weight> dist(n, INF);
    vector<int> prev(n, -1);

    dist[s] = 0;
    priority_queue<Edge> que;  // e < f <=> e.weight > f.weight

    for (que.push(Edge(-2, s, 0)); !que.empty(); ) {
        Edge e = que.top();  que.pop();
        if (prev[e.dst] != -1)
            continue;

        prev[e.dst] = e.src;
        for (auto f = g[e.dst].begin(); f != g[e.dst].end(); ++f) {
            if (dist[f->dst] > e.weight + f->weight) {
                dist[f->dst] = e.weight + f->weight;
                que.push(Edge(f->src, f->dst, e.weight + f->weight));
            }
        }
    }

    // Output
    for (int v = 0; v < n; ++v) {
        if (INF <= dist[v]) cout << "INF\n";
        else cout << dist[v] << '\n';
    }
}


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

    int n, m, r, s, t, d;

    cin >> n >> m >> r;
    Graph g(n);
    for (int i = 0; i < m; ++i) {
        cin >> s >> t >> d;
        g[s].emplace_back(Edge(s, t, d));
    }

    Dijkstra(g, r);

    return 0;
}




Measured memory_bytes: 19660
#include<stdio.h>
int main() {
	int H, W, X, Y;
	scanf("%d %d %d %d", &H, &W, &X, &Y);
	if (H*W%2==1 && (X + Y) % 2 == 1) {
		printf("No\n");
	}
	if (H*W%2 == 0 || (X + Y) % 2 == 0) {
		printf("Yes\n");
	}
	return 0;
}


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

const int N=2e6+100;
int mod=1e9+7;
typedef long long ll;
int a[N];
int main()
{
    int x;
    cin>>x;
     cout<<x+x*x+x*x*x<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 100005
#define mod 1000000007
int syutugenlist[MAXN];
int a[MAXN];
ll Pow(ll a, ll n) {
    if (n == 0) return 1;
    if (n % 2) return (a * Pow(a, n - 1)) % mod;
    else {
        ll k = Pow(a, n / 2);
        return (k * k) % mod;
    }
}
ll gyakusuu[MAXN + 1];
int main () {
    for (int i = 1; i <= MAXN; i++) {
        gyakusuu[i] = Pow(i, mod - 2);
    }
    int n;
    cin >> n;
    memset(syutugenlist, 0, sizeof(syutugenlist));
    for (int i = 1; i <= n + 1; i++) {
        cin >> a[i];
        syutugenlist[a[i]]++;
    }
    int index1 = 0; 
    int index2;
    for (int i = 1; i <= n + 1; i++) {
        if (syutugenlist[a[i]] == 2) {
            if (index1 == 0) {
                index1 = i;
            }
            else {
                index2 = i;
            }
        }
    }
    n++;
    ll p = n - (index2 - index1 + 1);
    // nCk - pC(k-1)
    ll nCk = n; //initial
    ll pc = 1;
    for (int k = 1; k <= n; k++) {
        //cout << nCk << " " << nCk - pc << endl;
        ll ret = nCk - pc;
        if (ret < 0) ret += mod;
        cout << ret << endl;
        nCk = ((nCk * (n - k)) % mod) * gyakusuu[k + 1] % mod;
        if (p < k) {
            pc = 0;
        }
        else {
            pc = (pc * (p - k + 1) % mod) * gyakusuu[k] % mod;
        }
    }
    return 0;
}

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

int main(){

    while(1){

        string s; cin >> s;
        if(s[0] == '#') break;

        //int a, b, c, d; cin >> a >> b >> c >> d;
        int w = 0;
        int h = 1;
        for(int i = 0; s[i] != '/'; i++){
            if(s[i] == 'b') w++;
            else w += (int)(s[i] - '0');
        }
        
        //cout << "ok" << endl;

        for(int i = 0; i != s.size(); i++){
            if(s[i] == '/') h++;
        }
        
        vector<vector<bool> > g(h, vector<bool> (w, false));

        int a, b, c, d; cin >> a >> b >> c >> d;
        int idx = 0;
        int i = 0, j = 0;
        while(idx != s.size()){
            //cout << i << " " << j << " " << idx << endl;
            if(s[idx] == '/'){
                i++;
                j = 0;
                idx++;
            }else if(s[idx] == 'b'){
                //cout << "ok" << endl;
                //cout << i << " "<< j << endl;
                g[i][j] = true;
                idx++;
                j++;
            }else{
                j += (int)(s[idx] - '0');
                idx++;
            }
        }

        /*for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cout << g[i][j] << " ";
            }
            cout << endl;
        }*/

        g[a - 1][b - 1] = false;
        g[c - 1][d - 1] = true;
        for(int i = 0; i < h; i++){
            int num = 0;
            for(int j = 0; j < w; j++){
                if(g[i][j]){
                    if(num > 0) cout << num << 'b';
                    else cout << 'b';
                    num = 0;
                }else num++;

                if(j == w - 1){
                    if(num > 0) cout << num;
                }
            }
            if(i != h - 1) cout << '/';
        }

        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

vector<int> tcard[2];
int n;

int main(void)
{
	while(cin >> n && n)
	{
		int taro = 0, hanako = 0;
		tcard[0].resize(n);
		tcard[1].resize(n);
		int i2 = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> tcard[0][i];
		}
		sort(tcard[0].begin(), tcard[0].end());
		if(tcard[0][0] != 0)
		{
			for (int i = 1; i < tcard[0][0]; i++)
			{
				tcard[1][i2] = i;
				i2++;
			}
		}

		int sadfasf = 0;

		for (int i = 1; i < n; i++)
		{
			for (int j = tcard[0][i] - tcard[0][i - 1] - 1; j - 1 >= 0; j--)
			{
				tcard[1][i2] = tcard[0][i - 1] + j;
				i2++;
			}
		}

		if(tcard[0][n - 1] != 2 * n)
		{
			for (int i = tcard[0][n - 1] + 1; i <= 2 * n; i++)
			{
				tcard[1][i2] = i;
				i2++;
			}
		}

		sort(tcard[1].begin(), tcard[1].end());
		int stage = tcard[0][0];
		tcard[0].erase(tcard[0].begin());
		for (int i = 1; tcard[0].size() && tcard[1].size(); i++)
		{
			bool flag = false;
			for (int j = 0; j < tcard[i&1].size(); j++)
			{
				if(stage < tcard[i&1][j])
				{
					stage = tcard[i&1][j];
					tcard[i&1].erase(tcard[i&1].begin() + j);
					flag = true;
					break;
				}
			}
			if(!flag)
			{
				stage = 0;
			}
		}

		cout << tcard[1].size() << endl;
		cout << tcard[0].size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
<?php
$L=trim(fgets(STDIN));
$p=[0,0];

for($i=0;$i<$L;$i++){
  $C=explode(' ',trim(fgets(STDIN)));

  if($C[0]<$C[1]){$p[1]+=3;continue;}
  if($C[0]>$C[1]){$p[0]+=3;continue;}
  ++$p[0];
  ++$p[1];
}

echo $p[0],' ',$p[1];
?>

Measured memory_bytes: 15408
#include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    typedef pair<ll , ll> pair_t;
    
    bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
    }
    
    int main(){
        ll n , t , x ,y ;
        cin >> n ;
        ll ans = 0;
        ll tx , ty , tt;
        tx = 0;
        ty = 0;
        tt = 0;
        ll temp;
        bool flg = true;
        for(ll i = 0 ; i < n ; i++){
            cin >> t >> x >> y;
            temp = abs(x - tx) + abs(y - ty);
            if(t - tt < temp){
                flg = false;
            }
            if( ((t - tt) % 2) != (temp  % 2)  ){
                flg = false;
            }
            tx = x;
            ty = y;
            tt = t;
        }
        if(flg){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        
        
        return 0;
        
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

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

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int a[100], b[100], c[100];
	for(int i = 0; i < n; i++){
		cin >> a[i];
		a[i]--;
	}
	for(int i = 0; i < n; i++){
		cin >> b[i];
	}
	for(int i = 0; i < n - 1; i++){
		cin >> c[i];
	}
	long long int ans = 0;
	for(int i = 0; i < n; i++){
		ans += b[a[i]];
		if(i > 0 && a[i] == a[i - 1] + 1) ans += c[a[i - 1]];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main
{
  public static void main(String args[])throws Exception
  {
    try {
    Scanner sc=new Scanner(System.in);
    int x[]=new int[5];
    int i;
    for(i=0;i<5;i++)
    x[i]=sc.nextInt();
    for(i=0;i<5;i++)
    {
      if(x[i]==0)
      {
        break;
      }
    }
    System.out.println(i+1);
    } catch(Exception e) { return;
                         } finally {
    }
  }
}
    


Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A,B;
  cin>>A>>B;
  if(A<10&&B<10){
cout<<A*B<<endl;
  }
else {
cout<<-1<<endl;
}
}

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define cutiii(a,b,c) cout << a << " " << b << " " << c << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef long long LL;
typedef pair<int ,int > pii;
typedef pair<string ,int > psi;
typedef pair<string ,string > pss;
typedef pair<LL, LL> pLL;

const long long oo = 1e9 + 7;
const double PI = acos(-1.0);

double DEG_to_RAD(double d) { return d * PI / 180.0; }

int a,b,c,d;

int main(){
   // freopen("test.txt","r",stdin);
    cin >> a >> b >> c >> d;
    if (  a + b > c + d) {
        cout << "Left" << endl;
    } else if ( a + b < c + d) {
        cout << "Right" << endl;
    } else {
        cout << "Balanced" << endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <iostream>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)

const int oo = 1e6;
int l[100007], r[100007], sum[100007];
int main() {
	int n, q; cin >> n >> q;
	string s; cin >> s;
	
	for (int i = 0; i < q; i++) {
		cin >> l[i] >> r[i];
	}
	for (int i = 1; i < n; i++) {
		if (s[i - 1] == 'A' && s[i] == 'C') {
			sum[i + 1] = sum[i] + 1;
		}
		else
			sum[i + 1] = sum[i];
	}

	for (int i = 0; i < q; i++) {
		cout << sum[r[i]] - sum[l[i]] << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);
    REP(i,n){
        cin >> h[i];
    }
    ll ans = 0;
    sort(h.begin(),h.end());
    REP(i,n-k){
        ans += h[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  long long int H,W;
  cin>>H>>W;
  long long int ans;
  if(H%2==0 || W%2==0){
    ans=H*W/2;
  }
  else{
    ans=H*W/2+1;
  }
  
  if(H==1 || W==1){
    ans=1;
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
		string input = Console.ReadLine();
		double n = double.Parse(input);
		double sho1 = n;
		double sho2 = 0;
		double i1 = 1;
		double i2 = 0;
		for(double i =1; i < Math.Sqrt(n)+1; i++)
		{
			double amari = n%i; 
			if(amari==0)
			{
				sho2 = n / i;
				i2 = n / sho2;
				if(i1+sho1>i2+sho2)
				{
					i1 = i2;
					sho1 = sho2;
				}
				else
				{
					continue;
				}
			}
			else
			{
				continue;
			}
		}
		Console.WriteLine(i1+sho1-2);
	}
}

Measured memory_bytes: 11220
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

int main() {
  int n, m, a, h, p, q;
  while (cin >> n >> m >> a, n | m | a) {
    int hor[1000][n+1];
    for (int i = 0; i < 1000; i++)
      for (int j = 0; j < n+1; j++)
        hor[i][j] = 0;
    while (m--) {
      cin >> h >> p >> q;
      hor[1000-h][p] = 1;
    }
    for (int i = 0; i < 1000; i++) {
      if (hor[i][a-1]) a--;
      else if (hor[i][a]) a++;
    }
    cout << a << el;
  }
}

Measured memory_bytes: 1552
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
int main()
{
    int N,K;
    cin >> N >> K;
    vll A(N);
    cin >> A;
    ll ans = 1LL << 60;
    for(int bit=0; bit<(1<<N); bit++){
        vint idxs;
        ll cost = 0;
        for(int i=0; i<N; i++){
            if(bit&(1<<i)){
                idxs.pb(i);
            }
        }
        if(idxs.size() < K)continue;
        ll hmax=A[0];
        int idx=0;
        REP(i,idxs.size()){
            for(int j=idx; j<idxs[i]; j++){
                if(A[j] > hmax){
                    hmax = A[j];
                }
            }
            if(0 == i){
                if(hmax >= A[idxs[i]]){
                    cost += hmax - A[idxs[i]];
                }
            }else{
                if(hmax >= A[idxs[i]]){
                    cost += hmax - A[idxs[i]] + 1;
                    hmax++;
                }else{
                    hmax = A[idxs[i]];
                }
            }
            idx = idxs[i]+1;
        }
        ans = min(ans,cost);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int n,p[10][10],dp[10][100010],ans;

void saiki(int sum,int x,int day,int I){
  int f=1;
  for(int i=I+1;i<n;i++) 
    if(p[day][i]>p[day-1][i])
      for(int j=1;x/(p[day-1][i]*j);j++)f=0, saiki(sum+p[day][i]*j,x-p[day-1][i]*j,day,i);

  if(f)ans=max(ans,sum+x);
 
}

int main(){
  int d,x;
  cin>>n>>d>>x;
  for(int i=0;i<d;i++)
    for(int j=0;j<n;j++)cin>>p[i][j];

  dp[0][x]=1;
  ans=x;
  for(int i=0;i<d-1;i++)saiki(0,ans,i+1,-1);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int bubbleSort(vector<int>& a, int n) {
  int count = 0;
  int flag = 1;
  while (flag) {
    flag = 0;
    for (int j = n - 1; j > 0; --j) {
      if (a[j] < a[j - 1]) {
        swap(a[j], a[j - 1]);
        flag = 1;
        ++count;
      }
    }
  }
  return count;
}

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

  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }

  int res = bubbleSort(arr, n);
  for (int i = 0; i < n; ++i) {
    cout << arr[i];
    if (i == n - 1) break;
    cout << " ";
  }
  cout << endl << res << endl;
  return 0;
}



Measured memory_bytes: 3116
#include<stdio.h>
#define MAX 100000 /* 最大値を定義 */
#define SENTINEL 2000000000
/*カードの構造体の宣言*/
struct Card{
char suit;
int value;
};

struct Card LEFT[MAX/2+2],RIGHT[MAX/2+2];

void merge(struct Card A[], int n, int left,int mid,int right){
int i,j,k;//適当な変数を用意
int n1= mid-left;//真ん中ー左端
int n2=right-mid;//右側ー中央
for(i=0;i<n1;i++) LEFT[i]=A[left+i];//左側の配列
for(i=0;i<n2;i++) RIGHT[i]=A[mid+i];//右側の配列
LEFT[n1].value=RIGHT[n2].value=SENTINEL;
i=j=0;
//左側から右側までの処理をする
for(k=left;k<right;k++){
//左右の数値を比較する
if(LEFT[i].value<=RIGHT[j].value){
A[k]=LEFT[i++];}
else{
A[k]=RIGHT[j++];
}
}
}

void mergesort(struct Card A[],int n,int left,int right){
int mid;//真ん中の部分の処理をする(中央値）
if(left+1<right){
mid =(left+right)/2;
mergesort(A,n,left,mid);
mergesort(A,n,mid,right);//右と左を分けて考える
merge(A,n,left,mid,right);
}
}

//前後2つの部分配列の処理をする
int partition(struct Card A[],int n,int p,int r){
int i,j;//さっきの変数i、jの処理をする
struct Card t,x;//構造体の変数t,xを宣言
x =A[r];
i=p-1;
for(j=p;j<r;j++){
if(A[j].value<= x.value){//xの値とj番目の数値の比較
i++;
//入れ替えにつての処理する
t=A[i];A[i]=A[j];A[j]=t;
}
}
//i+1とr番目の順序を入れ替える
t=A[i+1];A[i+1]=A[r];A[r]=t;
return i+1;
}

void quicksort(struct Card A[],int n,int p,int r){
int m;
if(p<r){
m=partition(A,n,p,r);
quicksort(A,n,p,m-1);
quicksort(A,n,m+1,r);
}
}

//実装させるためのメインメソッド
int main(){
int n,i,v;
struct Card A[MAX],B[MAX];
char S[10];
int stable =1;//安定か否か判定するstable
scanf("%d",&n);
for(i=0;i<n;i++){//n番目の要素までをfor文で回す
scanf("%s %d",S,&v);
A[i].suit=B[i].suit=S[0];
A[i].value=B[i].value=v;
}
mergesort(A,n,0,n);
quicksort(B,n,0,n-1);
for(i=0;i<n;i++){
//マージソートとクイックソートの結果を調べる
if(A[i].suit != B[i].suit)
stable=0;//一致していないときは0とする
}
if(stable==1) printf("Stable\n");
else printf("Not stable\n");
for(i=0;i<n;i++){
printf("%c %d\n",B[i].suit,B[i].value);
}
return 0;
}



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

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	int n, m, p[1024];
	char num[1024][16];
	while (cin >> n, n)
	{
		cin >> m;
		rep (i, n)
			cin >> num[i] >> p[i];
		
		int res = 0;
		while (m--)
		{
			char s[16];
			cin >> s;

			rep (i, n)
			{
				bool ok = true;
				rep (j, 8)
					if (num[i][j] != '*' && num[i][j] != s[j])
						ok = false;
				if (ok)
				{
					res += p[i];
					break;
				}
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 0
#!/usr/bin/env python3

#import
#import math
#import numpy as np
#= int(input())
#= input()
N, X, M = map(int, input().split())

def mod(x):
    return x % M

a = X

i = 0

ans = 0
last = -1

dic = []

while a != 0 and i < N:
    ans += a
    a = mod(a * a)
    i += 1

    if a in dic:
        last = dic.index(a)
        break

    dic.append(a)


if i != N and a != 0:
    tdic = dic[last:]
    if N - i >= len(tdic):
        sdic = sum(tdic)
        ans += sdic * ((N - i) // len(tdic))

    for j in range((N - i) % len(tdic)):
        ans += tdic[j]

print(ans)

Measured memory_bytes: 70808
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<vector>

using namespace std;

const int MAX_N = 500;
int n, k, s, a[MAX_N];
vector<int> di;

int main() {
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        s += a[i];
    }
    
    for (int i = 1; i * i <= s; i++) {
        if (s % i == 0) {
            di.push_back(i);
            if (i * i != s) di.push_back(s / i);
        }
    }
    
    int res = 0;
    while (di.size() > 0) {
        int q = di.back();
        di.pop_back();
        int b[n];
        long su[n];
        for (int i = 0; i < n; i++) {
            b[i] = a[i] % q;
        }
        sort(b, b + n);
        su[0] = b[0];
        for (int i = 1; i < n; i++) {
            su[i] = su[i - 1] + b[i];
        }
        for (int i = 0; i < n - 1; i++) {
            long m = q * (n - i - 1) - su[n - 1] + su[i];
            if (max(su[i], m) <= k && (su[i] - m) % q == 0) {
                res = max(res, q);
                continue;
            }
        }
    }
    printf("%d\n", res);
}


Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=[i-1 for i in a]
memo = [1]+[0]*(n-1)
telep=0
now=0
point=-1
while telep<k:
  telep+=1
  now=a[now]
  if memo[now]==0:
    memo[now]+=1
  else:
    point=now
    break
if point==-1:
  print(now+1)
  exit()
count=0
now=0
t=-1
while True:
  if now==point and t==-1:
    t=0
  now=a[now]
  if t==-1:
    count+=1
  if t>=0:
    t+=1
  if now==point and t!=-1:
    cycle=t
    break
l=(k-count)%cycle
k=count+l
telep=0
now=0
while telep<k:
  telep+=1
  now=a[now]
print(now+1)

Measured memory_bytes: 32412
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn=1e6+10;
int cnt,prime[maxn],a[maxn],p,ans;
bool f[maxn];
long long x;
int main()
{
	memset(f,1,sizeof f); f[0]=f[1]=0;
	for (int i=2;i<=1000000;i++)
	{
		if (f[i]) {prime[++cnt]=i;}
		for (int j=1;j<=cnt && 1ll*i*prime[j]<=1000000;j++)
		{
			f[i*prime[j]]=0;
			if (i%prime[j]==0) break;
		}
	}
	scanf("%lld",&x);
	for (int i=1;i<=cnt;i++)
	if (x%prime[i]==0)
	{
		p++;
		while (x%prime[i]==0) {a[p]++; x/=prime[i];}
	}
	if (x!=1) a[++p]=1;
	for (int i=1;i<=p;i++)
	{
		int x=a[i];
		for (int j=1;j<=60;j++) if (x>=j) ans++,x-=j;else break;
	}
	printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 5120
n,k=map(int,input().split())
a=list(map(int,input().split()))

c=[0]*(n+1)
for i in range(n):
    c[a[i]]+=1
c.sort(reverse=True)
csum=0
for i in range(k):
    csum+=c[i]
print(n-csum)

Measured memory_bytes: 25376
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vll A(N); REP(i, N) cin >> A[i];
    
    ll m = 0;
    REP(i, N) {
        if (m > A[i]) {
            print("No");
            return 0;
        }

        m = max(m, A[i] - 1);
    }
    print("Yes");
    
}


Measured memory_bytes: 3984
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	string s,t;
	cin>>s;
	int ans=0;
	char c=0;
	rep(i,s.size()){
		if(c==0){
			if(s[i]!=t[0]){
				ans++;
				t=s[i];
				c=0;
			}
			else c=s[i];
		}
		else {
			ans++;
			t=c+s[i];
			c=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }


int N;
int A[100010];
int gcdl[100010];
int gcdr[100010];


int gcd(int a, int b){
    return a%b ? gcd(b, a%b) : b;
}


signed main(){
    cin >> N;
    rep(i, 0, N) cin >> A[i];

    gcdl[0] = A[0];
    rep(i, 1, N) gcdl[i] = gcd(A[i], gcdl[i-1]);

    gcdr[N-1] = A[N-1];
    repr(i, N-1, 0) gcdr[i] = gcd(A[i], gcdr[i+1]);

    int ans = gcdr[1];
    rep(i, 1, N-1) chmax(ans, gcd(gcdl[i-1], gcdr[i+1]));
    chmax(ans, gcdl[N-2]);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
'use strict';
var NS = {};
function addProps(ns) {
    var isBrowser = function() {
        return typeof window !== 'undefined';
    }
    ns.isBrowser = isBrowser;
    
    var isNodejs = function() {
        return ! isBrowser();
    }
    ns.isNodejs = isNodejs;
    
    if (isBrowser()) {
        var getHtmlEncoded = function(string0) {
            return String(string0)
                    .replace(/&/g, '&amp;')
                    .replace(/"/g, '&quot;')
                    .replace(/'/g, '&#39;')
                    .replace(/</g, '&lt;')
                    .replace(/>/g, '&gt;');
        }
        ns.getHtmlEncoded = getHtmlEncoded;
        
        var outputCode = function() {
            document.getElementById('code').innerHTML = '<pre><code>' + getHtmlEncoded(addProps) + '</code></pre>';
        }
        ns.outputCode = outputCode;
    }
    
    var getInput = function() {
        var inputLines = [];
        if (isBrowser()) {
            var html = document.getElementById('input').innerHTML;
            inputLines = html.split('<br>');
        }
        if (isNodejs()) {
            inputLines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n');
        }
        return inputLines;
    }
    
    var doOutput = function(outputLines) {
        if (isBrowser()) {
            document.getElementById('output').innerHTML = outputLines.map(getHtmlEncoded).join('<br>\n');
        }
        if (isNodejs()) {
            for (var i = 0; i < outputLines.length; i++) {
                console.log(outputLines[i]);
            }
        }
    }
    ns.doOutput = doOutput;
    
    var getArea = function(a, b) {
        return a * b;
    }

    var getCircumference  = function(a, b) {
        return a + b + a + b;
    }
    
    var main = function() {
        var inputLines = getInput();
        var line0 = inputLines[0];
        var numStrings = line0.split(' ');
        var nums = [];
        for (var i = 0; i < numStrings.length; i++) {
            nums.push(Number(numStrings[i]));
        }
        var a = nums[0];
        var b = nums[1];
        var area = getArea(a, b);
        var circumference = getCircumference(a, b);
        var outputLine0 = area + ' ' + circumference;
        doOutput([outputLine0]);
    }
    ns.main = main;
}
addProps(NS);
if (NS.isBrowser()) {
    window.onload = function() {
        NS.outputCode();
    }
}
NS.main();

Measured memory_bytes: 7644
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans;
		
		if (s.equals("AAA") || s.equals("BBB")){
			ans="No";
		}else{
			ans="Yes";
		}

		System.out.println(ans);
		sc.close();
	}
}

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

int main() {
    string s;
    int K;

    cin >> s >> K;
    for (int i = 0; i < s.size(); i++) {
        char ch = s[i];
        int life = K;
        while (life > 0 && ch != 'a') {
            life--;
            ch = 'a' + (ch - 'a' + 1) % 26;
        }
        if (s[i] > ch) {
            K = life;
            s[i] = ch;
        }
    }
    K %= 26;
    int N = s.size();
    s[N - 1] = 'a' + (s[N - 1] - 'a' + K) % 26;

    cout << s << endl;

    return 0;
}

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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int main() {
    string S; cin >> S;
    int l = S.size();
    int ans = 0;
    rep(i, l) {
        int num = 0;
        rep(j, l - i) {
            if (S[i + j] == 'A' || S[i + j] == 'C' || S[i + j] == 'G' || S[i + j] == 'T') num++;
            else break;
        }
        ans = max(ans, num);
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

const int MAX_N = 200010;

int par[MAX_N];
int Rank[MAX_N];
int size;

void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        Rank[i] = 0;
    }
    size = n;
}

int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    size--;
    if (Rank[x] < Rank[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (Rank[x] == Rank[y]) {
            Rank[x]++;
        }
    }
}
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int K[2];
    cin >> N >> K[0] >> K[1];
    int E[2][200010];
    rep(k, 2){
        init(N);
        rep(i, K[k]) {
            int s, t;
            cin >> s >> t;
            s--; t--;
            unite(s, t);
        }
        rep(i, N) {
            E[k][i] = find(i);
        }
    }
    map<pair<int, int>, int> mp;
    rep(i, N) {
        //cout << E[0][i] << " " << E[1][i] << endl;
        mp[{E[0][i], E[1][i]}]++;
    }
    rep(i, N) {
        cout << mp[{E[0][i], E[1][i]}];
        if (i != N - 1) cout << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 15104