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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  string st0, st1;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) st0.push_back('0'); // push_backは1字(char)しか追加できない。文字列追加はappendで
    else st0.push_back('1');
  }
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) st1.push_back('1');
    else st1.push_back('0');
  }
  int ch0 = 0;
  int ch1 = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) != st0.at(i)) ch0++;
    if (s.at(i) != st1.at(i)) ch1++;
  }
  cout << min(ch0, ch1) << endl;
}

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

int H, W, N;
vector<int> B;

int main(void) {
	cin >> H >> W >> N;

	B.resize(H * W);
	int p = 0;
	for (int i = 1; i <= N; ++i) {
		int a;
		cin >> a;
		for (int j = 0; j < a; ++j)
			B[p++] = i;
	}

	for (int j = 0; j < H; ++j) {
		if (j % 2 == 0) {
			for (int i = j * W; i < j * W + W; ++i) {
				char c = (i == j * W + W - 1) ? '\n' : ' ';
				cout << B[i] << c;
			}
		}
		else {
			for (int i = j * W + W - 1; i >= j * W; --i) {
				char c = (i == j * W) ? '\n' : ' ';
				cout << B[i] << c;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 384
a, b = map(int, input().split())
if a <= 0 <= b:
    print("Zero")
    exit()
if 0 < a:
    print("Positive")
    exit()

if b < 0:
    diff = abs(b - a) + 1
    if diff % 2 == 0:
        print("Positive")
    else:
        print("Negative")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var TX = ReadSplitInt();
            Println(TX[0] * 1.0 / TX[1] );
        }

        static List<int> ReadLines(int n)
        {
            var l = new List<int>();
            for (int i = 0; i < n; i++)
            {
                l.Add(ReadInt());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

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



void solve()
{
   string s;
   cin >> s;
   int n = s.size() -1;
   if(s[n] == 's')
    cout << s+"es";
   else
    cout << s+"s";
}

int main()
{

    solve();
    cout << "\n";

}




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

int main() {
    int n, m;
    
    cin >> n;
    
    vector<string> unique = {};
    vector<int> c = {};
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        bool found = false;
        
        for (int j = 0; j < c.size(); j++) {
            if (unique.at(j) == s) {
                c.at(j)++;
                found = true;
                break;
            }
        }
        
        if (!found) {
            unique.push_back(s);
            c.push_back(1);
        }
    }
    
    cin >> m;
    
    for (int i = 0; i < m; i++) {
        string t;
        cin >> t;
        
        for (int j = 0; j < c.size(); j++) {
            if (unique.at(j) == t) {
                c.at(j)--;
                break;
            }
        }
    }
    
    int max = 0;
    for (int i = 0; i < c.size(); i++) {
        if (max < c.at(i)) max = c.at(i);
    }
    
    cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;


int main()
{
   FAST/**/
   
   ll n,k;
   cin>>n>>k;
   
   ll arr[n];
   rep(n)
        cin>>arr[i];
   
   sort(arr,arr+n,greater<ll>());
   ll ans = 0;
   rep(n)
   {
       if(k>0)
       {
           k--;
           continue;
       }
       
       ans+=arr[i];
   }
   
   cout<<ans;
   
   return 0;        
}  
   

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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

int R(int n, int M) {
    return (n+1) % M;
}

int S(int n, int N) {
    int tmp = 0;
    for (int i=0;i<N;i++) {
        tmp *= 3;
        tmp += (3 - (n%3)) % 3;

        n/=3;
    }

    int ans = 0;
    for (int i=0;i<N;i++) {
        ans *= 3;
        ans += (tmp % 3);

        tmp /=3;
    }

    return ans;
}

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

    int N;
    cin >> N;
    string T;
    cin >> T;

    int M = 1;
    for (int i=0;i<N;i++) M*=3;

    vi row(M, 0);
    vvi perms(N, row);
    
    int tp = 1;
    for (int i=0;i<N;i++) {
        for (int j=0;j<3*tp;j++) {
            perms[i][j] = j/tp;
        }
        tp *= 3;

        // cout << i << ": ";
        // for (int j=0;j<tp;j++) {
        //     cout << perms[i][j] << " ";    
        // }
        // cout << endl;
    }

    bool swap = false;
    int L = T.length();
    for (int i=0;i<L;i++) {
        if (T[i] == 'R') {
            int tp = 1;
            int overflow = 0;
            int nxtof = 0;
            for (int j=0;j<N;j++) {
                for (int k=0;k<3;k++) {
                    int cur = (overflow + k*tp) % (3*tp);
                    if (!swap) {
                        perms[j][cur] = (perms[j][cur] + 1) % 3;
                    } else {
                        perms[j][cur] = (perms[j][cur] + 2) % 3;
                    }
                    
                    if (perms[j][cur] == 0) nxtof = cur;
                }

                overflow = nxtof;
                tp *= 3;
            }
        } else if (T[i] == 'S') {
            if (swap) swap = false;
            else swap = true;
        }
    }

    // cout << "done" << endl;

    // tp = 1;
    // for (int i=0;i<N;i++) {
    //     tp *= 3;

    //     cout << i << ": ";
    //     for (int j=0;j<tp;j++) {
    //         cout << perms[i][j] << " ";    
    //     }
    //     cout << endl;
    // }

    vi salsa{0, 2, 1};

    for (int i=0;i<M;i++) {
        int tp = 1;
        int cur = 0;
        for (int j=0;j<N;j++) {
            if (!swap) cur += perms[j][i % (3*tp)]*tp;
            else cur += salsa[perms[j][i % (3*tp)]]*tp;
            tp *= 3;
        }
        cout << cur << " \n"[i+1==M];
    }

    return 0;
}

Measured memory_bytes: 31336
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){
	
	int x,y,z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << endl; 
	
	

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc161.contest.atcoder.jp/tasks/abc161_a

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


ll fctr(ll n){
    ll res = 1; 
    for (long long a = 2; a * a <= n; ++a) {
        if (n % a != 0) continue;
        long long ex = 0; // 指数

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

        // その結果を push
        res *= ex+1;
    }

    // 最後に残った数について
    if (n != 1) res *= 2;
    return res;
}


int main() {
    ll n;
    ll ans = 0;
    cin >> n;
    for (ll i = 1; i < n; ++i){
        ans += fctr(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
class UnionFind :
    #初期値の入力を行う
    def __init__(self, n) : 
        self.parent = [-1 for i in range(n)]
    
    #親ノードをとってくる処理    
    def root(self, x) :
        if self.parent[x] < 0 : 
            return x
        else : 
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
            
    #ノード同士の結合
    def merge(self, x, y) : 
        
        xr = self.root(x)
        yr = self.root(y)
        
        if(xr == yr) :
            return False
        else : 
            if(-self.parent[xr] > -self.parent[yr]) : 
                xr, yr = yr, xr
            
            #これで必ず xrの要素数 < yrの要素数 となる, 要素数が大きい方が必ず親となるように考えると
            
            # つなぐ = サイズ移動 + 親ノードの書き換え
            
            self.parent[yr] += self.parent[xr]
            self.parent[xr] = yr
            
            return True
            
    def size(self, x) : 
        return -self.parent[self.root(x)]
    
#n, mの入力を得る

n, m = map(int, input().split())

#bridgeの入力を得る

bridge = []

for i in range(m) : 
    a,b = map(int, input().split())
    bridge.append((a,b))
    
#UnionFindのインスタンスを作る

ufi = UnionFind(n)

#不便さの初期値を作る(nC2), inc = inconvinient

total = n * (n-1) / 2

inc_r = []
inc_r.append(total)
    
#後ろから橋を作っていって, 各iのときの不便さをリスト化する, #島の番号を0 ～ m-1 とするので, 橋の番号もそれぞれ-1する

for i in range(m-1, 0, -1) : 
    a = bridge[i][0] -1
    b = bridge[i][1] -1
    
    #不便さを求める

    #親ノードが等しいとき
    if(ufi.root(a) == ufi.root(b)) : 
        inc_r.append(inc_r[-1])
    #親ノードが等しくないとき
    else : 
        inc_r.append(inc_r[-1] -(ufi.size(a) * ufi.size(b)))
        
    #橋を作る
    ufi.merge(a, b)
    
inc = map(int, list(reversed(inc_r)))

for i in inc : 
    print(i)

Measured memory_bytes: 25608
import collections
N = list(input())
i = 0
result = 0
tmp = 0
for x in N:
  if tmp == x:
    result += 1
  tmp = x
  i += 1
count_n = collections.Counter(N)
print('Yes' if result >= 2 and count_n.most_common()[0][1] > 2  else 'No')

Measured memory_bytes: 3316
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])    


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const ll MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)
//std::sort(v.begin(), v.end(), std::greater<Type>());
//set_intersection(x, x+7, y, y+6, back_inserter(v));
//set_union(x, x+7, y, y+6, back_inserter(v));
//set_difference(x, x+7, y, y+6, back_inserter(v));

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}


int main(){
  char a;
  cin >> a;
  if(islower(a)){
    cout<< 'a' <<endl;
  }
  else{
    cout<< 'A' <<endl;
  }
}


Measured memory_bytes: 3572
n=int(input())
a=[int(x) for x in input().split()]
flag=1
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue 
        else:
            flag=0
            break
if flag==1:
    print("APPROVED")
else:
    print("DENIED")


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

int main(){
	long long int n = 0;
/*	long long int i = 0;	*/
	long long int x = 0;
	char* str;
	char* tmp;
	int j;
	long long int k = 1;
	int len;
	long long int div;
	long long int mod;

	str = (char*)calloc(100,sizeof(char));
	tmp = (char*)calloc(100,sizeof(char));
	scanf("%s",str);

	len = strlen(str);

	for(j=len-1; j>=0; j--){
		tmp[0] = str[j];
		tmp[1] = '\0';
		x += (long long int)atoi(tmp)*k;
		k *= 10;
	}

/*	printf("A%lld\n",x);	*/

	div = x/11;
	mod = x%11;

	n = div*2;

	if( mod > 0 ){
		n++;
		mod -= 6;
		if( mod > 0 ) n++;
	}

/*
	while( n < x ){
		i++;
		if( i%2 == 1 ){
			n += 6;
		}else{
			n += 5;
		}
	}
*/

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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	string s1, s2;
	cin >> s1 >> s2;
	if((s1[0] != s2[2]) || (s1[1] != s2[1]) || (s1[2] != s2[0])){
			cout << "NO" << endl;
	} else {
			cout << "YES" << endl;
	}
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  int M = 0;
  int m = 1000000000;
  
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a >= M) M = a;
    if (a <= m) m = a;
  }
  cout << M - m << endl;
}


Measured memory_bytes: 256
n=int(input())
a=sorted(list(map(int,input().split())))
flag=0
ans=1
a_cumulative=[0]
for i in range(n):
  flag+=a[i]
  a_cumulative.append(flag)
a.reverse()
a_cumulative.reverse()
for j in range(n-1):
  if a[j] <= a_cumulative[j+1]*2:
    ans+=1
  else:
    break
print(ans)

Measured memory_bytes: 65148
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
ll mod=998244353;

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    double ar[n];
    for(int i=0;i<n;i++){
        cin>>ar[i];
    }
    sort(ar,ar+n);
    double ans=(ar[0]+ar[1])/2;
    for(int i=2;i<n;i++){
        ans=(ans+ar[i])/2;
    }
    std::cout << std::fixed;
	cout<<std::setprecision(6)<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())

an1=0
an2=0
li=[0]*n

if m==0:
    print(an1,an2)
    exit()

for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    
    if s=="WA":
        if li[p-1]!=-1:
            li[p-1]+=1
    else:
        if li[p-1]!=-1:
            an1+=1
            an2+=li[p-1]
            li[p-1]=-1

print(an1,an2)

Measured memory_bytes: 3828
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  string S,T;
  cin>>S>>T;
  REP(i,S.size()){
    if(S.substr(i)+S.substr(0,i)==T){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char,int> map;
  string s;
  cin >> s;
  for(int i = 0;i < s.size();i++) {
    if(map.count(s.at(i))) {
      map.at(s.at(i))++;
    }else {
      map[s.at(i)] = 1;
    }
  }
  for (auto p : map) {
    auto value = p.second;
    if(value % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int X = sc.nextInt();
    sc.close();
    String ans = K * 500 >= X ? "Yes" : "No";
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

vector<int> to[2505];
vector<int> rto[2505];
bool reachablefrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachablefrom1[v]) return;
  reachablefrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}
void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  ll a = in(), b = in();
  ll ans = a - 2 * b;
  cout << (ans > 0 ? ans : 0) << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct TEMP_OMAZINAI_ { TEMP_OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } TEMP__omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void TEMP_INPUT_IMPL_() {};
template <class T, class... Args> void TEMP_INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; TEMP_INPUT_IMPL_(args...); }
void TEMP_OUTPUT_IMPL_() {};
template <class T, class... Args> void TEMP_OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); TEMP_OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; TEMP_INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define rsort_v(v) std::sort(v.rbegin(), v.rend())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (TEMP_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))
 
 // ^^^ Template ^^^ //

int main() {
	in(ll, N, K);
	in_v(ll, h, N);
	sort_v(h);
	ll ans = INF;
	loop(i, N-K+1)
		ans = min(h[i+K-1] - h[i], ans);
	out(ans);
}



Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd); FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<int> v(255);
    for(int i = 0; i < h; i++){
        for(int i = 0; i < w; i++){
            char c; cin >> c;
            v[c]++;
        }
    }
    int one = 0, two = 0;
    for(auto e : v){
        if(e % 4 == 0){
        }else if(e % 2 == 0){
            two++;
        }else{
            one++;
        }
    }
    if(h % 2 && w % 2){
        one--;
        two -= (h - 1) / 2 + (w - 1) / 2;
    }else if(h % 2 == 0 && w % 2){
        two -= h / 2;
    }else if(h % 2 && w % 2 == 0){
        two -= w / 2;
    }
    cout << (one > 0 || two > 0 ? "No" : "Yes") << '\n';
}


Measured memory_bytes: 256
##### 解けた #####

S=input()
A=[""]

for s in S: # 入力の文字列1文字ずつ見てゆく
    if s in ["0","1"]: # もし0か1の場合、それを追加
        A.append(s)
    elif s=="B": # もしバックスペースの場合、1文字削除
        if len(A)>=1: # 長さが1以上の場合のみ削除
            A.pop(-1)

print("".join(A))

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#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-1; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
using namespace std;
typedef long long ll;
int main(){
    int n,k;
    cin>>n;
    cin>>k;
    vector<int>h(n);
    REP(i,n)cin>>h[i];
    sort(ALL(h));
    ll a=0;
    if(n<=k)cout<<0<<endl;
    else{
        FOR(i,1,n-k)a+=h[i];
        cout<<a<<endl;
    }
}

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

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

  int a[2000001];

  for(int i=1;i<=2000000;i++){
    a[i]=0;
  }
  rep(i,n){
     int x;
     cin >> x;
     a[x]++;
  }

  int ans=0;

  for(int i=1;i<=2000000;i++){
    if(a[i]){
      if(a[i]==1) {
        ans++;
      }
      for(int j=i;j<=2000000;j+=i){
         a[j]=0;
      }

    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 11452
use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;
use std::cmp::*;
fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.ne();
    let num: Vec<i64> = (0..n).map(|_| sc.ne()).collect();
    let mut adj = vec![Vec::new(); n];
    for _ in 0..n - 1 {
        let u = sc.ne::<usize>() - 1;
        let v = sc.ne::<usize>() - 1;
        adj[u].push(v);
        adj[v].push(u);
    }
    fn dfs(adj: &Vec<Vec<usize>>, num: &Vec<i64>, cur: usize, par: usize) -> (i64, bool) {
        if adj[cur].len() == 1 {
            return (num[cur], true);
        }
        let mut kids = Vec::new();
        for nxt in &adj[cur] {
            if *nxt == par {
                continue;
            }
            let res = dfs(&adj, &num, *nxt, cur);
            if res.1 == false {
                return (0, false);
            }
            kids.push(res.0);
        }
        let sum = kids.iter().fold(0, |acc, &x| acc + x);
        if sum < num[cur] {
            return (0, false);
        }
        let ma = kids.iter().max().unwrap();
        // sum - num[cur] -> 子のペアの必要数
        if sum - num[cur] > min(sum - *ma, sum / 2) {
            return (0, false);
        }
        (2 * num[cur] - sum, true)
    }
    let ok = match n {
        2 => num[0] == num[1],
        _ => {
            let mut root = 0;
            for i in (0..n).filter(|&i| adj[i].len() > 1) {
                root = i;
                break;
            }
            let res = dfs(&adj, &num, root, root);
            // println!("{:?}", res);
            res.0 == 0 && res.1
        }
    };
    println!("{}", if ok { "YES" } else { "NO" });
}



struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => return None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => panic!("parse error"),
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}


Measured memory_bytes: 17404
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main() {
    string t;
    cin >> t;
    bool T = 1;
    while (!t.empty()) {
        if (t.length() >= 7 && t.substr(t.length() - 7, 7) == "dreamer") {
            if (t.length() == 7)break;
            t = t.substr(0, t.length() - 7);
        }
        else if (t.length() >= 6 && t.substr(t.length() - 6, 6) == "eraser") {
            if (t.length() == 6)break;
            t = t.substr(0, t.length() - 6);
        }
        else if (t.length() >= 5 && t.substr(t.length() - 5, 5) == "dream") {
            if (t.length() == 5)break;
            t = t.substr(0, t.length() - 5);
        }
        else if (t.length() >= 5 && t.substr(t.length() - 5, 5) == "erase") {
            if (t.length() == 5)break;
            t = t.substr(0, t.length() - 5);
        }
        else {
            T = 0;
            break;
        }
    }
    cout << (T ? "YES" : "NO") << endl;
}


Measured memory_bytes: 512
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
l = 1
r = max(a)

while l < r:
    m = (l + r) // 2
    cnt = 0
    for v in a:
        if m == 0:
            cnt += 2 * v
        else:
            cnt += (v + m - 1) // m - 1
    if cnt <= k:
        r = m
    else:
        l = m + 1

print(l)

Measured memory_bytes: 30980
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

const int INF = INT_MAX / 2;

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

    vector<int> a(6);
    for(int i=0; i<6; ++i)
        cin >> a[i];

    int start, goal;
    cin >> start >> goal;
    -- start;
    -- goal;

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

    vector<int> dist(m, INF);
    dist[goal] = 0;
    for(int k=0; k<m; ++k){
        for(int s=0; s<m; ++s){
            for(int i=0; i<6; ++i){
                for(int j=-1; j<=1; j+=2){
                    int t = s + a[i] * j;
                    if(t < 0 || m <= t)
                        continue;
                    t += n[t];
                    if(dist[t] + 1 < dist[s])
                        dist[s] = dist[t] + 1;
                }
            }
        }
    }

    int pos = start;
    for(;;){
        int dice;
        cin >> dice;
        -- dice;
        int ret = 0;

        int right = pos + a[dice];
        int left = pos - a[dice];

        if(0 <= right && right < m){
            right += n[right];
            if(dist[right] < dist[pos]){
                pos = right;
                ret = 1;
            }
        }

        if(0 <= left && left < m){
            left += n[left];
            if(dist[left] < dist[pos]){
                pos = left;
                ret = -1;
            }
        }

        cout << ret << endl;

        if(pos == goal)
            return 0;
    }
}

Measured memory_bytes: 1308
#include <iostream>
using namespace std;
int main(){
  int a, b, ans;
  cin >> a >> b;
  if( (b-1)%(a-1) ){ ans = (b-1)/(a-1)+1; }
  else			   { ans = (b-1)/(a-1);   }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    char topping[4];
    int pay = 700;
    
    cin >> topping;
    
    for(int i = 0; i < 3; i++){
        if(topping[i] == 'o') pay += 100;
    }
    
    cout << pay << endl;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for _ in range(N)]
d = {"A": 0, "B":0, "B_A": 0}
ans = 0
for s in S:
    ans += s.count("AB")
    if s[0] == "B" and s[-1] == "A":
        d["B_A"] += 1
    elif s[0] == "B":
        d["B"] += 1
    elif s[-1] == "A":
        d["A"] += 1

if d["B_A"] == 0 and d["A"] == 0:
    pass
elif d["B_A"] == 0:
    ans += min(d["A"], d["B"])
elif d["A"] == 0:
    if d["B"] == 0:
        ans += d["B_A"]-1
    else:
        ans += d["B_A"]
else:
    if d["B"] == 0:
        ans += d["B_A"]
    else:
        ans += d["B_A"]+1 + min(d["A"]-1, d["B"]-1)
print(ans)


Measured memory_bytes: 44504
import java.util.Scanner;
import java.util.*;
import java.lang.*; 
import java.util.regex.Pattern;
import java.text.DecimalFormat;
import java.util.stream.IntStream;
public class Main{    
public static void main(String[] args)
{     
Scanner scanner=new Scanner(System.in);
String s=scanner.next();
StringBuilder s1 = new StringBuilder(s);
int count=0;
int count1=0;
for(int i=1;i<s.length();i++)
{
  if(s1.charAt(i)==s1.charAt(i-1)){
    count++;
    if(s1.charAt(i)=='0')s1.setCharAt(i, '1');
    else if(s1.charAt(i)=='1')s1.setCharAt(i, '0');}
}
StringBuilder s2 = new StringBuilder(s);
for(int i=s.length()-1;i>0;i--)
{
  if(s2.charAt(i)==s2.charAt(i-1)){
    count1++;
    if(s2.charAt(i-1)=='0')s2.setCharAt(i-1, '1');
    else if(s2.charAt(i-1)=='1')s2.setCharAt(i-1, '0');}
}
if(count>count1)System.out.println(count1);
else System.out.println(count);
}
}






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


int main(){
    int64_t x, k, d, ans, t;
    cin >> x >> k >> d;

    if(x < 0) x = -1 * x;
    t = x / d;

    if(k <= t){
        ans = x - k * d;
    }else{
        if((k - t) % 2 == 0){
            ans = x - t * d;
        }else{
            ans = (t + 1) * d - x;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
 
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;
 
 
 
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;
}
 
 
//約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
	vector<int> ret;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			ret.push_back(i);
			if (i*i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return ret;
}
 
 
 
int main() {
 
	long long N;
    int H,W,K;
    char c[10][10];
    int ans;

    cin >>H>>W>>K;

    for (int i=0;i<H;i++){
        for (int j=0;j<W;j++){
            cin >> c[i][j];
        }
    }

    ans = 0;

    int choice_H[6];
    int choice_V[6];

    for (int bin = 0;bin < pow(2,H+W); bin++){
        int tmp_b=bin;
        int count_bl=0;
        for (int i=0;i<H;i++){
            if (tmp_b%2==1){
                choice_H[i]=1;
            }else{
                choice_H[i]=0;
            }
            tmp_b=tmp_b/2;
            
        }
        cout <<endl;
        for (int i=0;i<W;i++){
            if (tmp_b%2==1){
                choice_V[i]=1;
            }else{
                choice_V[i]=0;
            }
            tmp_b=tmp_b/2;
        }
        for (int i=0;i<H;i++){
            for (int j=0;j<W;j++){
                if (choice_H[i]==1 && choice_V[j]==1 && c[i][j]=='#'){
                    count_bl++;
                }else{
                }
            }
        }
        if (count_bl==K){
            ans++;
        }
    }

    cout << ans << endl;
	cin >> ans;
 
	return 0;
 
 
}

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

using namespace std;

const long long INF = 1000000000000;
const int N_MAX = 100;
const int V_MAX = 10000;
long long dp[N_MAX+1][V_MAX+1] = {};
int v[N_MAX+10], w[N_MAX+10];
int N, W;

int main() {
  int i, j;
  scanf("%d %d", &N, &W);
  for (i = 0; i < N; i++) {
    scanf("%d %d", &v[i], &w[i]);
  }
  dp[0][0] = 0;
  for (j = 1; j < V_MAX+1; j++) {
    dp[0][j] = INF;
  }
  for (i = 0; i < N; i++) {
    for (j = 0; j < V_MAX+1; j++) {
      if (j < v[i]) {
	dp[i+1][j] = dp[i][j];
      } else {
	dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
      }
    }
  }
  long long ans = 0;
  for (j = V_MAX; j > 0; j--) {
    if (dp[N][j] <= W) {
      ans = j;
      break;
    }
  }
  printf("%lld\n", ans);
  return 0;
}



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

int main(){
    string s;
    cin >> s;
    int n=s.size();
    int ans=0;
    for(int i=0;i<n;i++){
        if(s[i]=='o'){
            ans++;
        }
    }
    ans+=15-n;
    if(ans>7){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define MOD 1000000007
#define vec(a) vector<int>a
using namespace std;


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	ll n,i,j,k,l,m;
	cin>>n;
	ll arr[n];
	k=0;
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
		if(arr[i]%2==0)
		{
			if(arr[i]%3==0 || arr[i]%5==0)
				continue;
			k=1;
			break;
		}
	}
	if(k==1)
		cout<<"DENIED\n";
	else
		cout<<"APPROVED\n";

	return 0;
}
	

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=210;

ll gi() {
	ll x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n;
ll a[N],p[70];
char s[N];

void insert(ll v) {
	for(int i=60;~i;i--)
		if(v>>i&1) {
			if(!p[i]) { p[i]=v;break; }
			v^=p[i];
		}
}

bool in(ll v) {
	for(int i=60;~i;i--)
		if(v>>i&1) {
			if(!p[i]) return 0;
			v^=p[i];
		}
	return 1;
}

int main() {
	int T=gi();
	while(T--) {
		cin>>n;
		for(int i=1;i<=n;i++) a[i]=gi();
		scanf("%s",s+1);
		memset(p,0,sizeof(p));
		int ans=0;
		for(int i=n;i;i--) {
			if(s[i]=='0') {
				insert(a[i]);
			}
			else {
				if(!in(a[i])) { ans=1;break; }
			}
		}
		cout<<ans<<'\n';
	}
	return 0;
}


Measured memory_bytes: 3756
/* ex 5_4
   urah */

#include <stdio.h>
#include <string.h>


int main(void){
    //10文字以下なので最大の要素数は\0を含めて11
    char str[11];
    // S(str)の長さを代入する変数
    int length;
    // 部分文字列のACGT文字列の長さの最大値をいれる変数
    int max = 0;
    // すべての部分文字列のACGT文字列の長さについて数えていく変数
    int count;

    // 入力受け取り
    scanf("%s", str);
    // S(str)の長さの取得
    length = strnlen(str, 11);

    for(int i=0; i < length; i++){
        count = 0;
        for(int j=i; j < length; j++){
            // 部分文字がACGTのいずれかの場合
            if (str[j] == 'A' || str[j] == 'C' || str[j] == 'G' || str[j] == 'T') {
                count++;
            } 
            // ACGTのいずれでもない場合
            else {
                break;
            }
        }
        // 今までの最大値よりも長かった場合maxを更新
        if (max < count){
            max = count;
        }
    }

    // 答えの出力
    printf("%d\n", max);
    
    return 0;
}

Measured memory_bytes: 1704
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

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

	cin >> N;
	int ans = 0;
	vector<int>dp(N + 1);
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= i; j++) {
			int minus = j * (j - 1) / 2;
			if (minus >= i)break;
			if ((i - minus) % j)continue;
			dp[i]++;
		}
	}
	for (int i = 1; i <= N; i++) {
		if (N%i)continue;
		ans += dp[i] * dp[N / i];
	}
	cout << ans << endl;
}


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

int main()
{
  int N, M;
  cin >> N >> M;
  int left = 0;
  int right = 1000000;
  int L, R;
  for (int i = 0; i < M; i++)
  {
    cin >> L >> R;
    left = max(left, L);
    right = min(right, R);
  }
  if (left > right)
    cout << 0 << endl;
  else
  {
    int ans = right - left + 1;
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
//	file();
	fast();
	int n, m; cin >> n >> m;
	vi v1(n);
	int sum = 0;
	for (auto& it : v1) {
		cin >> it;
		sum += it;
	}
	int take = 0;
	for (auto& it : v1) {
		if (it >= (sum + 4 * m - 1) / (4 * m))
			take++;
	}
	if (take >= m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    int n; cin >> n;
    vector<ll> a(200005,-1);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    ll ans = a[0];
    int count = 1;
    rep(i,n-2)
    {
        ans += a[count];
        if(i % 2)
        {
            ++count;
        }
    }
    pri(ans);
    return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
string ans="";
int main()
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()<=k)
	{
		cout<<s<<endl;
		return 0;
	}
	for(int i=0;i<k;i++)
		ans+=s[i];
	ans+="...";
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 800010
using namespace std;
ll n,k,val[N],ans=0,sz;
vector<ll> st,sum;
void update(ll x)
{
	ll pos;
	pos=lower_bound(st.begin(),st.end(),x)-st.begin();
	pos+=sz;
	while(pos>0)
	{
		val[pos]++;
		pos>>=1;
	}
	return;
}
ll getans(ll x,ll l,ll r,ll v)
{
	if(st[r]<v)
	{
		return 0;
	}
	if(st[l]>=v)
	{
		return val[x];
	}
	ll mid=(l+r)>>1;
	return getans(x*2,l,mid,v)+getans(x*2+1,mid+1,r,v);
}
int main(){
	ll i,a;
	cin>>n>>k;
	sum.push_back(0);
	for(i=0;i<n;i++)
	{
		cin>>a;
		a-=k;
		sum.push_back(sum[sum.size()-1]+a);
		st.push_back(sum[sum.size()-1]);
	}
	sort(st.begin(),st.end());
	memset(val,0,sizeof(val));
	for(sz=1;sz<=st.size();)
	{
		sz*=2;
	}
	while(st.size()<sz)
	{
		st.push_back(st[st.size()-1]);
	}
	for(i=n;i>=0;i--)
	{
		ans+=getans(1,0,sz-1,sum[i]);
		update(sum[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10340
N = int(input())

A = [1]
tmp = 6
while tmp < 10**5:
    A.append(tmp)
    tmp *= 6
tmp = 9
while tmp < 10**5:
    A.append(tmp)
    tmp *= 9

Ans = [float("inf")] * (10**5+1)
Ans[0] = 0

for i in range(1,10**5+1):
    tmp = float("inf")
    for j in A:
        if i-j >= 0:
            if tmp > Ans[i-j] + 1:
                tmp = Ans[i-j] + 1
    Ans[i] = tmp
print(Ans[N])

Measured memory_bytes: 44108
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toInt)
    val (r, s, p) = readLine()!!.split(' ').map(String::toLong)
    val t = readLine()!!
    val hands = t.map {
        when (it) {
            'r' -> 'p'
            'p' -> 's'
            's' -> 'r'
            else -> 'x'
        }
    }.toMutableList()
    for(i in k until n){
        if(hands[i]==hands[i-k])hands[i]='x'
    }
    val ans = hands.map {
        when (it) {
            'r' -> r
            'p' -> p
            's' -> s
            else -> 0L
        }
    }.sum()
    println(ans)
}

Measured memory_bytes: 43488
n, q = map(int, input().split())
s = input()

flg = False
acm = []
cnt = 0
for a in s:
    if a == 'A':
        flg = True
    elif a == 'C' and flg:
        cnt += 1

    if a != 'A':
        flg = False
    acm.append(cnt)

for _ in range(q):
    l, r = map(int, input().split())
    print(acm[r-1]-acm[l-1])

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

#define all(v) v.begin(), v.end()
#define mp make_pair
#define EPS (int)1e-9
#define PI acos(-1)
#define endl '\n'
#define pb push_back
#define fi first
#define se second

using namespace std;
using ld = long double;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

const int mod = 1000000007;


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int r, g, b;
	cin >> r >> g >> b;

	int t = r*100 + g*10 + b;
	if(t % 4 == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
ll N;

int main(){
    //ll P , Q , R;
    //cin >> P >> Q  >> R;

    ll A, B;
    cin >> A >> B;
    ll ans = max(A+B, A -B);
    ll ans2 = max(A-B, A * B);
    cout << max(ans, ans2) << endl;

    /*
    string v;
    cin >> v;
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    if(v.length() == 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    */
}

Measured memory_bytes: 256