akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

long count(int x[], int nx, int y[], int ny, int z[], int nz) {
   int i,j,k,jj,kk,l;
   long a;

   a=jj=kk=0;
   for (i=0;i<nx;i++) {
       for (j=jj;j<ny;j++)
          if (y[j]>x[i]) break;
       if (j==ny) continue;
       jj=j;
       for (k=kk;k<nz;k++)
          if (z[k]>x[i]) break;
       if (k==nz) continue;
       kk=k;
       for (;j<ny && k<nz;)
          if (y[j]<z[k]) {
             for (l=k;l<nz;l++)
                if (y[j]-x[i]!=z[l]-y[j]) a++;
             j++;
          } else {
             for (l=j;l<ny;l++)
                if (z[k]-x[i]!=y[l]-z[k]) a++;
             k++;
          }
   }
   return a;
}

int main(){
   int i,n,r[4000],g[4000],b[4000],rp,gp,bp;
   char s[4001];
   long sum;

   scanf("%d",&n);
   scanf("%s",s);
   rp=gp=bp=0;
   for (i=0;i<n;i++)
      if (s[i]=='R') r[rp++]=i;
      else if (s[i]=='G') g[gp++]=i;
      else b[bp++]=i;
   sum=count(r,rp,g,gp,b,bp);
   sum+=count(g,gp,r,rp,b,bp);
   sum+=count(b,bp,g,gp,r,rp);
   printf("%ld\n",sum);
   return 0;
}


Measured memory_bytes: 1744
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    int n; cin>>n;
    int ans = 0, k = 1, keta = 1;
    for(int i=9;; i=i*10+9){
        if(keta&1 && i <= n){
            ans += 9*k;
        }
        else if(keta&1 && i > n){
            ans += n-i/10;
        }
        k *= 10;
        keta++;
        if(i>n) break;
    }
    OUT(ans);
}

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

using namespace std;

int main(void){

	int mem, kyogi;
	cin >> kyogi >> mem;
	int money[kyogi];
	int kijun[mem];
	int score[kyogi];
	//かかる費用を入力
	for(int i = 0; i < kyogi; i++){
		cin >> money[i];
		score[i] = 0;
	}
	//審査員の基準を入力
	for(int i = 0; i < mem; i++){
		cin >> kijun[i];
	}

	for(int i = 0; i < mem; i++){
		for(int j = 0; j < kyogi; j++){
			if(kijun[i] >= money[j]){
				score[j]++;
				break;
			}
		}
	}
	int log, max = 0;
	for(int i = 0; i < mem; i++){
		if(score[i] > max){
			max = score[i];
			log = i;
		}
	}
	cout << log+1 << endl;

}

Measured memory_bytes: 1172
N,K=(map(int,input().split()))
a=[i for i in range(1,N+1)]
d=[]
A=[]
b=[]
count=0
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
for i in A:
    for j in i:
        b.append(j)
b1=list(dict.fromkeys(b))
for i in b1:
    if i in a:
        count+=1
print(N-count)

Measured memory_bytes: 9140
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    int MOD = 1000000007;
    
    long long int power = 1;
    for(int i=1; i<=N; i++){
        power *= i;
        power %= MOD;
    }
    
    cout << power << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int N;cin>>N;
  long long ax[N],bx[N];
  for (int i=0;i<N;i++){
    cin>>ax[i]>>bx[i];
  }
  long long cnt=0;
  long long k = 0;
  for (int i=N-1;i>=0;i--){
    if ((ax[i] + cnt) % bx[i] !=0){
      k = bx[i] - ((ax[i] + cnt) % bx[i]);
      cnt += k;
    }
}
  cout<<cnt<<endl;
}


Measured memory_bytes: 1920
#define ll long long
#define ffor(i,a,b) for (int i=(a);i<(b);i++)
#define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

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

  string a,s,c;
  cin >> a >> s >> c;

  cout << "A" << s[0] <<"C"<< endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  vector<int> a(26,0);
  string s;
  cin >> s;
  
  rep(i,s.size()){
    a[s[i] - 'a']++;
  }
  
  rep(i,26){
    if(a[i] == 0){
      char ans = 'a' + i;
      cout << ans;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 512
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,d:usize,
        x:[[i64;d];n],
    }
    let mut nijos = BTreeSet::new();
    for i in 0..150 {
        nijos.insert(i * i);
    }
    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            let mut root = 0;
            for ten in 0..d {
                root += (x[i][ten] - x[j][ten]) * (x[i][ten] - x[j][ten]);
            }
            if nijos.contains(&root) {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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

string s;

const int maxn = 300005;
int dp[maxn][2][3][4];
const int mod = 1e9 + 7;

void add(int &a, int b){
    a += b;
    if(a >= mod){
        a -= mod;
    }
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> s;
    s += "1";
    memset(dp, 0, sizeof(dp));
    int n = s.length();
    dp[0][0][0][0] = 1;
    for(int i = 1;i <= n;i++){
        for(int parity = 0;parity < 2;parity++){
            for(int type = 0;type < 3;type++){
                for(int S = 0;S < 4;S++){
                    if(s[i - 1] == '0' or s[i - 1] == '?'){
                        int ntype = type;
                        if(type == 0){
                            ntype = 1;
                        }else if(type == 1){
                            ntype = 2;
                        }else{
                            ntype = 1;
                        }
                        add(dp[i][parity][ntype][S], dp[i - 1][parity][type][S]);
                    }
                    if(s[i - 1] == '1' or s[i - 1] == '?'){
                        int nparity = parity;
                        if(type != 1){
                            nparity = parity ^ 1;
                        }
                        int ntype = 0;
                        int S1 = S;
                        if(type == 0){
                            if(nparity == 0){
                                if(S1 & 1){
                                    S1 = 3;
                                }
                            }else{
                                S1 |= 1;
                            }
                        }
                        add(dp[i][nparity][ntype][S1], dp[i - 1][parity][type][S]);
                    }
                }
            }
        }
    }
    int ans = 0;
    for(int parity = 0;parity < 2;parity++){
        add(ans, dp[n][parity][0][3]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 28820
fn find_prime(frm : i32) -> i32 {
    let mut prime = 0;
    let mut i = frm;
    loop {
        let x = i as f64;
        let xx = x.sqrt().floor() as i32;
        //println!("{} {}", i,xx);
        let mut is_prime = true;
        for j in 2..(xx+1) {
            if i % j == 0 {
                is_prime = false;
                break;
            }
        }
        if is_prime {
            prime = i;
            break;
        }
        i += 1;
    }
    return prime;
}

use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let n : i32 = get_one();
    let p = find_prime(n);
    println!("{}", p);
}


Measured memory_bytes: 4352
import numpy as np
N, L = (int(x) for x in input().split())

A = [i+L for i in range(N)]
A = np.array(A)
if L >= 0:                                                                                                                                                                                                  
    print(np.sum(A[1:]))                                                                                                                                                                                    
                                                                                                                                                                                                            
elif L < 0:                                                                                                                                                                                                 
    if N + L - 1 <=0:                                                                                                                                                                                       
        print(np.sum(A[:-1]))                                                                                                                                                                               
    else:                                                                                                                                                                                                   
        print(np.sum(A[:]))    

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

int main() {
    deque<string> Q;
    string s, c, t;
    int q, a, b, count=0;
    cin >> s >> q;
    Q.push_back(s);
    for(int i=0; i<q; i++) {
        cin >> a;
        if(a==1) count++;
        else {
            cin >> b >> c;
            if(b==1) {
                if(count%2==0)  Q.push_front(c);
                else Q.push_back(c);
            }
            else {
               if(count%2==0) Q.push_back(c);
                else Q.push_front(c);
            }
        }
    }
    while(!(Q.empty())) {
        if(count%2==0) {
            cout << Q.front();
            Q.pop_front();
        }
        else {
            t=Q.back();
            reverse(t.begin(), t.end());
            cout << t;
            Q.pop_back();
        }
    }
}

Measured memory_bytes: 11648
#include <queue>
#include <vector>
#include <iostream>

using namespace std;
const int N_MAX = 100000;
vector<int> works[N_MAX + 1];

int main(){
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        works[a].push_back(b);
    }

    priority_queue<int> queue;
    int sum = 0;
    for(int i = m-1;i >= 0; i--){
        int a = m - i;
        for(auto b : works[a]){
            queue.push(b);
        }
        if(queue.empty()) continue;
        sum += queue.top();
        queue.pop();
    }
    cout << sum << endl;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

struct UnionFind
{
    vector<long long> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    long long root(long long x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(long long x, long long y)
    {                           // xとyの木を併合
        long long rx = root(x); //xの根をrx
        long long ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(long long x, long long y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        long long rx = root(x);
        long long ry = root(y);
        return rx == ry;
    }
};

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

    ll N,Q;
    string S;
    cin >> N>>Q;

    UnionFind tree(N);

    REP(i,Q){
        ll t, a, b;
        cin >> t >> a >> b;

        if(t==0){
            tree.unite(a, b);
        }
        else{
            if(tree.same(a,b)==true){
                cout << 1 << endl;
            }
            else{
                cout << 0 << endl;
            }
        }
    }
}


Measured memory_bytes: 4648
#!/usr/bin/env python3
import itertools

N = int(input().split()[0])
# a_list = list(map(int, input().split()))
a_list = []
xy_list_list = []

for _ in range(N):
    a = int(input().split()[0])
    a_list.append(a)
    xy_list = []
    for _ in range(a):
        x, y = list(map(int, input().split()))
        xy_list.append((x, y))
    xy_list_list.append(xy_list)

# 2 ** 3 パターン
p_list = list(itertools.product([0, 1], repeat=N))
max_c = 0

for pattern in p_list:  # 2 ** 15
    is_ok = True
    for i in range(N):  # 15
        if pattern[i] == 0:
            # 真偽不明
            continue
        for xy in xy_list_list[i]:  # 15
            x, y = xy
            x = x - 1
            if pattern[x] != y:
                # 矛盾
                is_ok = False
                break
        if not is_ok:
            # 矛盾
            break
    if is_ok:
        max_c = max(max_c, sum(pattern))

ans = max_c
print(ans)


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

int calc_dist (int x, int y, int x_1, int y_1){
	int dist = abs(x_1 - x) + abs(y_1 - y);
    return dist;
}
 
int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;
  string U(N * 2, 'a');
  int count = 0;
  for(int i = 0; i < N; i++){
    U.at(count) = S.at(i);
    U.at(count + 1) = T.at(i);
    count += 2;
  }
  cout << U << endl;
}

Measured memory_bytes: 256
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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


use std::cmp;

fn main(){
    input! {
        n: usize, w: usize,
        a: [chars; n],
    }

    let mut dp = vec![vec![0; w]; n];
    for i in 0 .. n {
        if a[i][0] == '#'{ break }
        dp[i][0] = 1;
    }
    for i in 0 .. w {
        if a[0][i] == '#'{ break }
        dp[0][i] = 1;
    }
    for i in 1 .. n {
        for j in 1 .. w {
            if a[i][j] == '.' {
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % 1000000007;
            }
        }
    }

    println!("{}", dp[n-1][w-1]);
}




Measured memory_bytes: 12540
N = int(input())
A = [int(v) for v in input().split(" ")]
B = [int(v) for v in input().split(" ")]

count = 0

for i in range(0, N):
    a0 = A[i]
    b = B[i]
    
    if a0 < b:
        A[i] = 0
        count += a0
        b -= a0

        a1 = A[i+1]
        if a1 < b:
            A[i+1] = 0
            count += a1
        else:
            A[i+1] -= b
            count += b
    else:
        A[i] -= b
        count += b
print(count)


Measured memory_bytes: 18436
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = rl()
print(max(li) - min(li))









Measured memory_bytes: 27088
w = int(input())
n = int(input())

A = list()
B = list()

S = [i for i in range(1, w + 1)]
G = [0 for i in range(w)]

for i in range(n) :
    a , b = map(int, input().split(","))
    A.append(a)
    B.append(b)
    
for i in range(1, w + 1) :
    g = i
    for j in range(n) :
        if(A[j] == g) :
            g = B[j]
        elif(B[j] == g) :
            g = A[j]
        else :
            pass
    G[g - 1] = i
    
for i in range(w) :
    print(G[i])


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

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

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

 //それぞれを等しくするために必要な操作回数を計算しb数列に対する処理が多い場合はできづそれ以外ではできる
  int main(){
     lint N;
     cin >>N; lint A[N];
     rep(i,N)cin >> A[i];
     lint B[N];
     rep(i,N)cin>>B[i];
     lint counta=0,countb=0;
     rep(i,N){
         if(A[i]<B[i]){
             if((B[i]-A[i])%2==1){
                 B[i]++;
                 countb++;
             }
             counta+=(B[i]-A[i])/2;
         }
          if(A[i]>B[i]){
             countb+=(A[i]-B[i]);
         }
     }
     if(countb>counta)cout<<"No";
     else cout<<"Yes";

    }
     
  


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int n,x,y;
const int INF = 1001001001;
vector<int> ans,visited,dist;
void dfs(int now){
    visited[now] = 1;
    
    if(now+1< n && !visited[now+1]){
        dist[now+1] = min(dist[now+1],dist[now] +1);
        dfs(now+1);
        visited[now+1] = 0;
    }
    if(now-1 >= 0 && !visited[now-1]){
        dist[now-1] = min(dist[now-1],dist[now] +1);
        dfs(now-1);
        visited[now-1] = 0;
    }
    if(now == x && !visited[y]){
        dist[y] = min(dist[y],dist[now]+1);
        dfs(y);
        visited[y] = 0;
    }
    if(now == y && !visited[x]){
        dist[x] = min(dist[x],dist[now] +1);
        dfs(x);
        visited[x] = 0;
    }
}

int main()
{
    
    cin >> n >> x >> y;
    x--;y--;
    ans.resize(n);
    visited.resize(n);
    dist.resize(n,INF);
    rep(i,n){
        dist[i] = 0;
        dfs(i);
        rep(j,n)ans[dist[j]]++;
        dist = vector<int>(n,INF);
        visited = vector<int>(n,0);
    }
    rep(i,n)ans[i]/=2;
    rep(i,n-1)cout << ans[i+1] << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
bool isoddnodigits(int k)
{
  int c=0;
  while(k)
  {
    c++;
    k=k/10;
  }
  if(c%2!=0)
return 1;
  else
    return 0;
}
int main()
{
int n;
  cin>>n;
  int i;int c=0;
  for(i=1;i<=n;i++)
  {
    if(isoddnodigits(i))
      c++;
  }
  cout<<c;
return 0;
}

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

int main()
{
  int t,n,f,s;
  while(1){
    cin>>t;
    if(t==0)break;
    cin>>n;
    int sum=0;
    for(int i=0;i<n;i++){
      cin>>f>>s;
      sum+=(s-f);
    }
    if(t<=sum)cout<<"OK"<<endl;
    else cout<<t-sum<<endl;
  }

  return 0;
}

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

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main()
{
    string S,T;
    cin>>S>>T;

    for(int i=0;i<S.length();i++){
        if(S[i]!=T[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

    return 0;
}

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

int main() {
    string S;
    cin >> S;
    set<char> set;
    for (int i = 0; i < S.size(); i++) {
        if (set.count(S[i]) != 0) {
            cout << "no" << endl;
            return 0;
        }
        set.insert(S[i]);
    }
    cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;
void a_atcoder_contest(void) {
	string a,s,c;
	cin >> a>>s>>c;
	cout << a[0] << s[0] << c[0] << endl;;
}

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


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

const int N = 200005;

int id[N], val[N], min[N], max[N], add[N], pri[N], n, k, t, ans;
int lc[N], rc[N];
void setadd(int x, int v) {
	min[x] += v, max[x] += v, add[x] += v, val[x] += v;
}
void pushdown(int x) {
	if (add[x]) setadd(lc[x], add[x]), setadd(rc[x], add[x]), add[x] = 0;
}
void pushup(int x) {
	min[x] = max[x] = val[x];
	if (lc[x]) min[x] = std::min(min[x], min[lc[x]]), max[x] = std::max(max[x], max[lc[x]]);
	if (rc[x]) min[x] = std::min(min[x], min[rc[x]]), max[x] = std::max(max[x], max[rc[x]]);
}
void split(int now, int k, int &x, int &y) {
	if (!now) return void(x = y = 0);
	pushdown(now);
	if (id[now] <= k)
		x = now, split(rc[x], k, rc[x], y);
	else
		y = now, split(lc[y], k, x, lc[y]);
	pushup(now);
}
int merge(int x, int y) {
	if (!x || !y) return x | y;
	if (pri[x] < pri[y])
		return pushdown(x), rc[x] = merge(rc[x], y), pushup(x), x;
	else
		return pushdown(y), lc[y] = merge(x, lc[y]), pushup(y), y;
}

int root;
void dfs(int &x, int k) {
	if (!x) return;
	if (min[x] == max[x] && min[x] == k - 1) return setadd(x, 1);
	pushdown(x);
	dfs(lc[x], k), dfs(rc[x], k);
	if (val[x] == k - 1) return val[x] += 1, pushup(x);
	x = merge(lc[x], rc[x]);
}
void count(int x) {
	if (!x) return;
	pushdown(x);
	if (val[x] == k) ++ans;
	count(lc[x]), count(rc[x]);
}
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::srand(std::time(0));
	std::cin >> n >> k >> t;
	for (int i = 1; i <= n; ++i)
		pri[i] = std::rand(), id[i] = i, pushup(i), root = merge(root, i);
	for (int i = 1; i <= t; ++i) {
		int l, r, g;
		std::cin >> l >> r >> g;
		int a, b;
		split(root, r, root, b);
		split(root, l - 1, a, root);
		dfs(root, g);
		root = merge(a, merge(root, b));
	}
	count(root);
	std::cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 9468
use proconio::input;
use std::cmp;

fn main() {
    input! {
        n: usize,
        me: [(usize, usize); n],
    }

    let mut flag = false;
    let mut count = 0;
    let mut max = 0;
    for &m in &me {
        
        if m.0 == m.1 {
            if !flag {
                count = 0;
            }
            count +=1;
            max = cmp::max(max, count);
            flag = true;
        } else {
            flag = false;
        }
    }

    if max >= 3 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2188
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c,k;
int main()
{
    cin >> a >> b >> c >> k;
    if(k - a >= 0)
    {
        k -= a;
        if(k - b > 0) cout << a - (k - b);
        else cout << a;
    }
    else cout << k;
    return 0;
}


Measured memory_bytes: 3636
char s[65536],t[65536];
int n,i,r,w,c;
int main()
{
	for(;scanf("%d",&n),n;){
		scanf("%s",s);
		for(i=0;i++<n;strcpy(s,t)){
			for(r=w=0;r<strlen(s);t[w++]=s[r],r+=c){
				for(c=0;s[r+c]==s[r];++c);
				for(sprintf(t+w,"%d\0",c);t[++w];);
			}
			t[w]=0;
		}
		puts(s);
	}
	exit(0);
}

Measured memory_bytes: 496
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i,n) cin >> a.at(i);
int cnt = 0;
rep(i,n){
  int t = a.at(i);
  while(!(t%2)){
    cnt++;
    t /=2;
  }
}
cout << cnt << endl;
}


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

using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<n;i++)
#define IREP(i,n) for(ll i=1;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG(x) cerr << x << "\n"

int main(){
    set<int> po;
    int a,b,c;
    cin >> a >> b >> c;
    po.insert(a);
    po.insert(b);
    po.insert(c);
    cout << po.size() << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll N;
    string S;
    cin>>N>>S;
    ll count=0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                bool flag1=false;
                bool flag2=false;
                bool flag3=false;
                for(int l=0;l<N;l++){
                    if(S.at(l)-'0'==i&&flag1==false){
                        flag1=true;
                    }
                    else if(S.at(l)-'0'==j&&flag2==false){
                        if(flag1==true){
                            flag2=true;
                        }
                    }
                    else if(S.at(l)-'0'==k){
                        if(flag2==true){
                            flag3=true;
                        }
                    }
                }
                if(flag3==true){
                    count++;
                }
            }
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner

fun main(args: Array<String>) {
  val cin = Scanner(System.`in`)
  val a = cin.nextInt()
  val b = cin.nextInt()

  if (a <= 8 && b <= 8) {
    println("Yay!")
  } else {
    println(":(")
  }

  cin.close()
}

Measured memory_bytes: 31136
#include <cstdio>
#include <algorithm>

using namespace std;

int board[100][100];
int H, W, N;

int main(){
	scanf("%d %d %d", &W, &H, &N);
	for (int i = 0; i < N; ++i){
		int x, y, a;
		scanf("%d %d %d", &x, &y, &a);
		if (a == 1){
			for (int nx = 0; nx < x; ++nx){
				for (int ny = 0; ny < H; ++ny)board[nx][ny] = 1;
			}
		}
		else if (a == 2){
			for (int nx = x; nx < W; ++nx){
				for (int ny = 0; ny < H; ++ny)board[nx][ny] = 1;
			}
		}
		else if (a == 3){
			for (int nx = 0; nx < W; ++nx){
				for (int ny = 0; ny < y; ++ny)board[nx][ny] = 1;
			}
		}
		else if (a == 4){
			for (int nx = 0; nx < W; ++nx){
				for (int ny = y; ny < H; ++ny)board[nx][ny] = 1;
			}
		}
	}
	int answer = 0;
	for (int x = 0; x < W; ++x){
		for (int y = 0; y < H; ++y){
			if (board[x][y] == 0)answer++;
		}
	}
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int a,b;
  std::cin >> a >> b;
  std::cout << a-b+1 << '\n';
  return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<int> S(N);
    for (int i = 0; i < N; ++i) cin >> S[i];
    int Q;
    cin >> Q;
    vector<int> T(Q);
    for (int i = 0; i < Q; ++i) cin >> T[i];
    int res = 0;
    for (auto&& t : T) {
        if (binary_search(S.begin(), S.end(), t)) ++res;
    }
    cout << res << endl;
    return 0;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
    int n;
    cin >> n;
    vector<int> a(n+1);
    rep(i, n) cin >> a[i];
    a[n] = a[0];

    ll sum = 0;
    rep(i, n) sum += a[i];
    ll k = sum/((1ll+n)*n/2);
    if(sum%((1ll+n)*n/2) != 0 || k <= 0){
        cout << "NO" << endl;
        return 0;
    }

    rep(i, n){
        if(a[i]-a[i+1]+k < 0 || (a[i]-a[i+1]+k)%n != 0){
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;


    return 0;
}



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

int main() {
    int n;cin >> n;
    vector<int> dpa(n+5, 0), dpb(n+5, 0), dpc(n+5, 0);
    for (int i = 0; i < n; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        dpa[i+1] = max(dpb[i], dpc[i]) + a;
        dpb[i+1] = max(dpa[i], dpc[i]) + b;
        dpc[i+1] = max(dpa[i], dpb[i]) + c;
    }
    cout << max(dpa[n], max(dpb[n], dpc[n])) << endl;
    
    return 0;
}

Measured memory_bytes: 4560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

int main() {
	ll N, x, y;
	cin >> N;
	if (N == 2) {
		cout << 1 << endl;
		return 0;
	}
	ll cnt = 2;

	for (ll i = 2;i * i <= N;i++) {
		x = N;
		if (x % i)continue;
		while (x % i == 0) {
			x = x / i;
		}
		if ((x - 1) % i == 0) {
			cnt++;
		}
	}
	N--;
	for (ll i = 2;i * i <= N;i++) {
		if (N % i == 0) {
			if (i * i == N)cnt++;
			else cnt += 2;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 384
(function(input) {
    var lines = input.split('\n');
    for (var i = 0; i < lines.length; i++) {
        var items = lines[i].split(' ').map(Number);
        var h = items[0];
        var w = items[1];
        if (!h && !w) {
            break;
        }
        console.log(
            Array(w + 1).join('#') + '\n' +
            Array(h - 1).join('#' + Array(w - 1).join('.') + '#\n') +
            Array(w + 1).join('#') + '\n'
        );
    }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7644
package main
 
import (
	"fmt"
  	"math"
  //"sort"
	//"strconv"
)
 
func main() {
  var N,K int
  fmt.Scanf("%d %d",&N,&K)
  for i:=0.0;i<1000.0;i++{
    if math.Pow(float64(K),i)<=float64(N) && float64(N)<math.Pow(float64(K),i+1){
      fmt.Println(i+1) 
    }
  }
}

Measured memory_bytes: 512
#define _crt_secure_no_warnings
#include<bits/stdc++.h>
#include<functional>
#define ll long long
#define Test int t;cin>>t;while(t--)
#define PI 3.14159265
#define endl "\n"
int dx[]= {-1,-1,-1,0,0,0,1,1,1};
int dy[]= {-1,0,1,-1,0,1,-1,0,1};
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll a[100001];
ll b[100001];
int main()
{
    fast();
    ll x,cnt=0;
    cin>>x;
    for(ll i=100;i<x;){
        double z=i+(i*0.01);
        i=z;
        cnt++;
    }
    cout<<cnt;
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  
  int i = K;
  int j = 1;
  while (true) {
    if ((N / i) > 0) {
      i = i * K;
      j++;
    } else {
      cout << j << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a = 0, b = 0, c = 0, d = 0, e = 0, k = 0;
	if (scanf("%d", &a) == 1);
	if (scanf("%d", &b) == 1);
	if (scanf("%d", &c) == 1);
	if (scanf("%d", &d) == 1);
	if (scanf("%d", &e) == 1);
	if (scanf("%d", &k) == 1);
	if (e - a > k)
		printf(":(");
	else
		printf("Yay!");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define ll long long
int a[200000+20];
int main ()
{
	ll n,i,ans=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i],a[i]-=(i+1);
	sort(a,a+n);
	for(i=0;i<n;i++)
		ans+=fabs(a[i]-a[i/2]);
	cout<<ans<<endl;
 } 

Measured memory_bytes: 1024
#include<bits/stdc++.h> 
using namespace std;
int b;
int main(){
    string a;
    cin>>a;
    int l=a.size();
    for(int i=0;i<l;i++)        //枚举每一个点 
    {
        if(a[i]=='S')           //如果有向南的 
        {
            b=0;                //清空 
            for(int i=0;i<l;i++)
            {
                if(a[i]=='N')   //只要有一个向北的就OK 
                {
                    b=1;        //赋值为1 
                    break;      //找到一个就退出 
                }
            }
            if(b==0)        //如果b==0，就是如果没找到N（北） 
            {
                cout<<"No"<<'\n';   //输出"No",注意换行，不然会全WA 
                return 0;               //直接退出 
            }
        }
        if(a[i]=='N')                   //同上 
        {
            b=0;
            for(int i=0;i<l;i++)
            {
                if(a[i]=='S')
                {
                    b=1;
                    break;
                }
            }
            if(b==0)
            {
                cout<<"No"<<'\n';
                return 0;
            }
        }
        if(a[i]=='E')           //同上 
        {
            b=0;
            for(int i=0;i<l;i++)
            {
                if(a[i]=='W')
                {
                    b=1;
                    break;
                }
            }
            if(b==0)
            {
                cout<<"No"<<'\n';
                return 0;
            }
        }
        if(a[i]=='W')           //同上 
        {
            b=0;
            for(int i=0;i<l;i++)
            {
                if(a[i]=='E')
                {
                    b=1;
                    break;
                }
            }
            if(b==0)
            {
                cout<<"No"<<'\n';
                return 0;
            }
        }
    }
    cout<<"Yes"<<'\n';      //最后直接输出Yes就OK 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.nextLine());

        String[] values = scanner.nextLine().split(" ");
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = Integer.parseInt(values[i]);
        }

        int sum = a[0];
        for (int i = 1; i < N; i++) {

            sum = sum ^ a[i];

        }

        System.out.println(sum == 0 ? "Yes" : "No");

        scanner.close();

    }

}


Measured memory_bytes: 48672
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li, li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li, li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b) {
	if (b)cout << "Yes";
	else cout << "No";
}
void yes(li b) {
	if (b)cout << "yes";
	else cout << "no";
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cout.precision(16);

	li N,K;
	cin >>N>>K;

	vi A(N);
	Input(A);

	SortD(A);

	li sum =accumulate(All(A),0LL);

	vi B(N);
	li cnt=N+K;

	Rep(i,N){
		B[i]=(cnt*A[i])/sum;
      if(!B[i])B[i]++;
	}

	cnt -= accumulate(All(B),0LL);

	li ans=0;

	vi C(N);

	Rep(i,N){
		C[i]=(A[i]+B[i]-1)/B[i];
	}

	SortD(C);

	cout <<C[cnt];

}

Measured memory_bytes: 7936
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr if(0)cout
#endif
ll a;
int main()
{
	vector<ll>v;
	ll hey=3;
	while(hey--){
		cin>>a;v.pb(a);
	}
	sort(all(v));
	cout<<v[0]+v[1]<<'\n';
}


Measured memory_bytes: 256
package main

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

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}

func main() {
	N := nextInt()
	X := nextInt()

	D := 0

	for i := 1; i <= N; i++ {
		L := nextInt()

		if D+L == X {
			fmt.Println(i + 1)
			return
		}
		if D+L > X {
			fmt.Println(i)
			return
		}
		D += L
	}
	fmt.Println(N + 1)
}


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

int main() {
  int N, count, sum;
  cin >> N;
  sum = 0;
  count = 0;
  
  for (int a = 0; a <= ( N / 7 ); a++) {
    for (int b = 0; b <= ( N / 4 ); b++) {
      sum = 7 * a + 4 * b;
      if (sum == N) count++;
    }
  }
  if (count == 0) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let c: usize = iter.next().unwrap().parse().unwrap();

    if a >= c {
        println!("{}", 0);
        return;
    } else if a + b < c {
        println!("{}", "NA");
        return;
    } else {
        println!("{}", c - a);
        return;
    }
}



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

using namespace std;

void getDivs(long long n, vector<long long> &divs) {
    for (int i = 1; 1LL * i * i <= n; i++) {
        if (n % i == 0) {
            if (i != 1)
                divs.push_back(i);
            if (1LL * i * i != n)
                divs.push_back(n / i);
        }
    }
    sort(divs.begin(), divs.end());
}

void solve() {
    long long n; cin >> n;
    vector<long long> divsn, divsnn;
    getDivs(n, divsn);
    getDivs(n - 1, divsnn);
    int ans = divsnn.size();
    for (auto k : divsn) {
        long long nn = n;
        while (nn % k == 0)
            nn /= k;
        if (nn % k == 1)
            ans++;
    }
    cout << ans;
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 384
#include <iostream>
#define rep(i,s,t) for (int i = s ; i <= t ; i ++)
typedef long long ll;
using namespace std;

int main()
{
    int k,s;
    ll ans = 0;
    cin>> k >> s;
    rep(i,0,k)
       rep(j,0,k)
       {
           if (s - i - j <= k && s - i - j >= 0)
              ans ++;
       }
    cout<< ans <<endl;
}


Measured memory_bytes: 256
A,B,C,D,e,F=gets.split.map(&:to_i)
at,as,tmp=0,0,0
e=e/(100+e).to_f
(F.div(A)+1).times{|i|
  t=i*A*100
  0.step{|j|
    tt=j*B*100
    break if t+tt>F || t+tt==0
    0.step{|k|
      s=k*C
      break if t+tt+s>F
      0.step{|l|
        ss=l*D
        break if t+tt+s+ss>F
        if t+tt+s+ss!=0 then
          r=(s+ss)/(t+tt+s+ss).to_f
          tmp,at,as=r,t+tt+s+ss,s+ss if r>=tmp && r<=e
        end
      }
    }
  }
}
puts "#{at} #{as}"


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define int long long int 


struct BIT 
{
    int bit_tree[100005];
    public:
    BIT()
    {
        memset(bit_tree,0,sizeof(bit_tree));
    }

    void update(int index,int value)
    {
            while(index<100005)
            {
                bit_tree[index]+=value;
                index+=(index&(-index));
            }
    }

    int get(int index)
    {
        int sum=0;
        while(index>0)
        {
            sum+=bit_tree[index];
            index-=(index&(-index));
        }
        return sum;
    }
};
int32_t main()
{
    int n,m;
    cin>>n>>m;

    vector<array<int,2>> graph;
    for(int i=0;i<m;i++)
    { 
        int x,y;
        cin>>x>>y;
        graph.push_back({y,x});
    }
    sort(graph.begin(),graph.end());
    //  for(int i=0;i<m;i++)
    //  {
    //      cout<<graph[i][0]<<" "<<graph[i][1]<<endl;
    //  }
    struct BIT bit;
    int ans=0;
    for(int i=0;i<m;i++)
    {
        int x=bit.get(graph[i][0])-bit.get(graph[i][1]);
        if(x==0)
        {

             bit.update(graph[i][0],1); 
             ans++;
        }
    }
    cout<<ans<<endl;



}

Measured memory_bytes: 5624
#include<iostream>
int main(){
    int iA,iB;
    std::cin>> iA >> iB;
    iA += iB;
    if( iA % 2){
        std::cout << iA / 2 + 1 << std::endl;
    }else{
        std::cout << iA / 2 << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

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

using namespace std;
using ll = long long;

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

    if (equal(begin(S), end(S), begin(T))) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
using namespace std;
	typedef long long int lli;
	const int MaxN=100005;
	int alt[MaxN];
	int vis[MaxN];
	int pase[MaxN];
int main(){
	lli N,M,i,j,p,q,res=0;
	cin>>N>>M;
	for(i=1;i<=N;i++)cin>>alt[i];
	for(i=0;i<M;i++){
		cin>>p>>q;
		vis[p]+=1,vis[q]+=1;
		if(alt[p]>alt[q])pase[p]+=1;
		else if(alt[q]>alt[p])pase[q]+=1;
	}
	for(i=1;i<=N;i++){
		//if(vis[i]==0)continue;
		if(vis[i]==pase[i])res+=1;
		//cout<<vis[i]<<" "<<pase[i]<<" "<<i<<"\n";	
	}	
	cout<<res;
}

Measured memory_bytes: 4356
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <cmath>
#define rep(i,N) for(int i=0; i<N;i++)
using namespace std;

int main(){
    int N,M,X;
    cin>>N>>M>>X;
    vector<vector<int> > A(N, vector<int>(M));
    vector<int> C(N);
    rep(i,N){
        cin>>C.at(i);
        rep(j,M){
            cin >>A.at(i).at(j);
        }
    }
    vector<int> comb(N);
    int min_c=pow(10,7);
    rep(k,pow(2,N)-1){
        comb.at(0)++;
        rep(i,N){
            if(comb.at(i)>1){
                comb.at(i+1)++;
                comb.at(i)=0;
            }
           // cout<<comb.at(i)<<" ";
        }
        vector<int> calc(M);
        int ok=1;
        int cost=0;
        rep(i,N){
            rep(j,M){
                calc.at(j)+=A.at(i).at(j)*comb.at(i);
            }
            cost+=C.at(i)*comb.at(i);
        }
        rep(i,M){
            if(calc.at(i)<X){
                ok=0;
            }
        }
        if(ok==1){
            if(cost<min_c){
                min_c=cost;
            }
        }


       // cout<<endl;
    }
    if(min_c==pow(10,7))min_c=-1;
    cout<<min_c<<endl;




    return 0;
}

Measured memory_bytes: 4048