akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;

int main(void){
    string s;
    cin >> s;
    int l = s.length();
    if(s[l-1] == 's') {cout << s << 'e' << 's' << endl;}
    else{cout << s << 's' << endl;}
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	map<int, int> mp;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		mp[a]++;
	}

	vector<int> cnds;
	for (auto p : mp) {
		while (p.second >= 2) {
			p.second -= 2;
			cnds.push_back(p.first);
		}
	}

	if (cnds.size() < 2) {
		cout << 0 << '\n';
	} else {
		cout << (long long)(cnds.end()[-1]) * cnds.end()[-2] << '\n';
	}

	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n,m;
	while(1){
		int ans=0;
		cin>>n>>m;
		if(n==0 && m==0) break;
		vi d(n);
		rep(i,0,n){
			cin>>d[i]; ans+=d[i];
		}
		sort(all(d));
		reverse(all(d));
		rep(i,0,n){
			if((i+1)%m==0) ans-=d[i];
		}
		o(ans);
	}	
}

Measured memory_bytes: 1216
n = int(input())

s = 0
i = 0 
ans = []
# 値をカウントアップしていき、nを超える値になるまで繰り返す。
# 全ての値を保存する
while s < n:
  i += 1
  s += i
  ans.append(i)
  
delete = s - n # 取得した合計値からnを引き、差分を取得
if delete != 0: ans.remove(delete) # 差分を削除
  
for t in ans: print(t)

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

int main()
{
	string s, t;
	cin >> s >> t;
	bool ans = false;
	for (int i = 0; i < s.length(); i++) {
		if (s == t)
			ans = true;
		s = s.back() + s.substr(0, s.length() - 1);
	}
	if (ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int M,D,ans=0;
    cin>>M>>D;
    for(int m=4;m<=M;m++){
        for(int d=22;d<=D;d++){
            if(d%10>=2&&(d%10)*(d-(d%10))/10==m){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = myRead.readIntArray();
            int[,] a = new int[s[0], s[1] + 1];
            for (int i = 0; i < s[0]; i++)
            {
                var k = myRead.readIntArray();
                for (int j = 0; j < s[1] + 1; j++)
                {
                    a[i, j] = k[j];
                }
            }
            int min = -1;

            for (int bit = 0; bit < (1 << s[0]); bit++)
            {
                int[] b = new int[s[1] + 1];
                for (int j = 0; j < s[0]; j++)
                {
                    if ((bit & (1 << j)) == (1 << j))
                    {
                        for (int i = 0; i < s[1] + 1; i++)
                        {
                            b[i] += a[j, i];
                        }
                    }
                    bool condition = true;
                    for (int i = 1; i < s[1] + 1; i++)
                    {
                        if (b[i] < s[2])
                        {
                            condition = false;
                            break;
                        }
                    }
                    if (condition == true && (b[0] < min || min == -1))
                    {
                        min = b[0];
                    }
                }
            }
            WriteLine(min);
            Out.Flush();
        }
    }
    public static class myRead
    {
        public static int readInt() { return int.Parse(ReadLine()); }
        public static long readLong() { return long.Parse(ReadLine()); }
        public static string reatStr() { return ReadLine(); }
        public static int[] readIntArray() { return ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        public static long[] readLongArray() { return ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        public static string[] readStrArray() { return ReadLine().Split(' '); }
    }


    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return (m == 1 || m == 0) ? 1L : n * Pow(n, m - 1); }
    }


}

Measured memory_bytes: 28460
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int ll;

int values[100009];
int n;
int dp[100009];

int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> values[i];

  dp[0] = 0;
  dp[1] = abs(values[1]-values[0]);

  for (int i = 2; i < n; i++) {
    dp[i] = min(dp[i-2]+abs(values[i]-values[i-2]), dp[i-1]+abs(values[i]-values[i-1]));
  }

  cout << dp[n-1] << endl;
}


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

int main() {
    int N, M;
    cin >> N;
    cin >> M;
    int everyone_love = 0;
    vector<int> assemble(M+1);
    for (int i = 0; i < N; i++) {
        int kind;
        cin >> kind;

        for (int k = 0; k < kind; k++) {
            int temp;
            cin >> temp;
            assemble[temp]++;
        }
    }
    for (int l = 0; l < M+1; l++) {
        if (assemble[l] == N) {
            everyone_love++;
        }
    }
    cout << everyone_love << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    bool a[26] = {0};
    string s;
    cin >> s;
    for(unsigned int i = 0; i < s.size(); i++){
        a[int(s[i]) - int('a')] = 1;
    }
    for(int i = 0; i < 26; i++){
        if(a[i] == 0){
            cout << char(int('a') + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

public class Main {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] h = new int[n];

        for( int i = 0 ; i < n ; i++){
            h[i] = scanner.nextInt();
        }

        Arrays.sort(h);
        long  hsum = 0;
        for( int i =  0 ; i < (n - k) ; i++){
            hsum += h[i];
        }

        System.out.println(hsum);
    }
}

Measured memory_bytes: 87552
N,C=gets.split.map &:to_i
d=[]
C.times{d<<(gets.split.map &:to_i)}
c=[]
N.times{c<<(gets.split.map &:to_i)}
p=[];q=[];r=[]
for i in 0...N
  for j in 0...N
    if (i+j)%3==0
      p<<c[i][j]
    elsif (i+j)%3==1
       q<<c[i][j]
    else
       r<<c[i][j]
    end
  end
end
h=Hash.new 0
p.each{|e|h[e.to_i]+=1}
p=h
h=Hash.new 0
q.each{|e|h[e.to_i]+=1}
q=h
h=Hash.new 0
r.each{|e|h[e.to_i]+=1}
r=h
m=10000000000

if  N==1
p 0;exit
end


for i in 0...C
  for j in 0...C
    next if i==j
    for k in 0...C
      next if i==k || j==k
      a=0
 p.each{|y,v|a+=v*d[y-1][i]}
      q.each{|y,v|a+=v*d[y-1][j]}
      r.each{|y,v|a+=v*d[y-1][k]}
      m=a if a<m
      
    end
  end
end
p m

Measured memory_bytes: 6456
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

signed main() {
	string s; cin >> s;
	int ans = 0;
	int n = s.size();
	rep(i, n) rep(j, 1, n - i + 1) {
		if (j == n) {
			ans += atoll(s.c_str());
			continue;
		}
		string t = s.substr(i, j);
		int num = atoll(t.c_str());
		int comb = 1ll << (n - j - 1 - (i != 0 && i + j != n));
		ans += num * comb;
	}
	cout << ans << endl;
	system("pause");
}

Measured memory_bytes: 504
import math

a, b, c = map(int, input().split())

# a + b + 2 sqrt(ab) < c
# c - a - b > 2 sqrt(ab)
# (c - a - b)^2 > 4ab

if (c - a - b)**2 > 4 * a * b and c - a - b > 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 39764
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<vector>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define qread(x) x=read()
#define mes(x,y) memset(x,y,sizeof(x))
#define mpy(x,y) memcpy(x,y,sizeof(x))
#define Maxn 150500
#define INF 2147483647
inline int read(){
	int f=1,x=0;char ch;
	while(!(ch>='0'&&ch<='9')){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
struct Problem{
	int x,y;
}a[Maxn+1];
int n,d,f[Maxn+1],max,ans;
char s[Maxn+1];
int main(){
	//freopen("c.in","r",stdin);
	//freopen("c.out","w",stdout);
	qread(n),qread(d);d/=100;
	max=0;
	for(int i=1;i<=n;i++){
		qread(a[i].x),qread(a[i].y);
		a[i].y=(a[i].y/100)+a[i].x*i;
		max+=a[i].y;
	}
	mes(f,63);f[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=max;j>=0;j--){
			for(int k=1;k<=a[i].x;k++){
				if(j>=i*k)f[j]=std::min(f[j-i*k]+k,f[j]);
			}
			if(j>=a[i].y)f[j]=std::min(f[j-a[i].y]+a[i].x,f[j]);
		}
	}
	ans=INF;
	for(int i=d;i<=max;i++)ans=std::min(ans,f[i]);
	printf("%d\n",ans);
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vi ps;
	{
		vi isp(300000,1);
		isp[0]=isp[1]=0;
		rep(i,isp.size()) if(isp[i]) for(int j=i+i;j<isp.size();j+=i)
			isp[j]=0;
		rep(i,isp.size()) if(isp[i])
			ps.push_back(i);
	}
	
	for(int n;cin>>n,n;){
		iter(ps) it1=upper_bound(allof(ps),n);
		iter(ps) it2=upper_bound(allof(ps),2*n);
		cout<<it2-it1<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String top = sc.next();
        char[] flag = top.toCharArray();
        int sum = 700;
        for(int i = 0;i < top.length();i++){
            if(flag[i] == 'o'){
                sum += 100;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

namespace std {
    template <>
    class hash<std::pair<int, int>> {
    public:
        size_t operator()(const std::pair<int, int>& x) const{
            return hash<int>()(x.first) ^ hash<int>()(x.second);
        }
    };
}

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N; cin >> N;
    double odd = 0;
    for (int i = 1; i <= N; i++) {
        if (i%2) {
            odd += 1;
        }
    }
    printf("%.12f\n", odd/N);
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <cstdlib>
using namespace std;
map <string,int> cost;
multimap <string,string>  rule;
set <string> his,his2;
int flg;

void update(string a){
  his2.insert(a);
  multimap<string,string>::iterator it=rule.find(a);
  while(it != rule.end() && it->first == a) {
    if(his2.count(it->second)==0&&cost[it->second]>cost[a])cost[it->second] =cost[a],update(it->second);
    it++;
  }
}

int  mk_rule(string a){
  if(his.count(a) == 0){
    his.insert(a);    
    multimap<string,string>::iterator it=rule.find(a);
    while(it != rule.end() && it->first == a) {
      cost[a] = min(cost[a],mk_rule(it->second));
      it++;
    }
    his2.clear();
    update(a);
    it=rule.find(a);
    while(it != rule.end() && it->first == a) {
      if(cost[it->second]  > cost[a])exit(1);
      it++;
    }

  }
  return cost[a];
}

int main(){
  int n,m,b;
  cin >> n;
  string a,c,ls[5002];
  for(int i=0;i<n;i++) {
    cin >> a >> b;
    cost[a] = b , ls[i] = a;
  }
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> a >> c;
    rule.insert(pair<string,string>(a,c));
    rule.insert(pair<string,string>(c,a));
  }
  int ans=0;
  for(int i=0;i<n;i++) ans += mk_rule(ls[i]);
  cout << ans <<endl;
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    int tmp_N = N;
    N = N * 3;
    long long s[N];
    for(int i = 0; i<N ; i++) {
        cin >> s[i];
    }

    sort(s, s + N, greater<int>());
    long long res = 0;
    int cnt = 0;
    for(int i = 0; i<N; i++) {
        if(i % 2 == 1) {
            res += s[i];
            cnt++;
            if(cnt >= tmp_N) break;
        } 
    }
    cout << res << endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(){
    int a[10][10],n,i,j,tate[10]={0},yoko[10]={0},sum=0;
    while(cin>>n){
        if(n==0)break;
        for(i=0;i<n;i++){
            for(j=0;j<n;j++){
                cin>>a[i][j];
                sum+=a[i][j];
                yoko[i]+=a[i][j];
                tate[j]+=a[i][j];
            }
        }
        for(i=0;i<n;i++){
            for(j=0;j<=n;j++){
                if(j==n)printf("%5d\n",yoko[i]);
                else printf("%5d",a[i][j]);
            }
        }
        for(j=0;j<=n;j++){
            if(j!=n)printf("%5d",tate[j]);
            else if(j==n)printf("%5d\n",sum);
        }
        for(i=0;i<10;i++){
            tate[i]=0;
            yoko[i]=0;
        }
        sum=0;
    }
     return 0;
}

Measured memory_bytes: 3128
#include <stdio.h>

int main(void) {
	int cars[10] = {0};	
	int order,i=0;
	
	while( scanf("%d", &order) != EOF ) {
		if(order == 0) {
			printf("%d\n", cars[i-1]);
			cars[i--] = 0;
		}
		else if(1<=order && order<=10) {
			cars[i++] = order;
		}
		else continue;
	}
	
	return 0;
} 

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)
 
string s;
int main() {
    cin >> s;
    s = REPLACE(s, "P\\?", "PD");
    s = REPLACE(s, "\\?D", "PD");
    s = REPLACE(s, "\\?\\?", "PD");
    s = REPLACE(s, "\\?", "D");
    cout << s;
    return 0;
}

Measured memory_bytes: 4224
n, k = map(int, input().strip().split(" "))
h = list(map(int, input().split(" ")))

dp = [0] * n
dp[1] = abs(h[0]-h[1])

for i in range(2, n):
    dp[i] = min([abs(h[i]-h[j])+dp[j] for j in range(max(0, i-k), i)])

print(dp[n-1])

Measured memory_bytes: 52192
#!/usr/bin/env python3
#ABC129 C

n,m = list(map(int,input().split()))
a = [int(input()) for _ in range(m)]
dp = [0]*(n+1)
flg = [True]*(n+1)
mod = 1000000007
for i in a:
    flg[i] = False
dp[0] = 1
for i in range(1,n+1):
    if flg[i]:
        if i == 1:
            dp[i] += dp[i - 1]
        else:
            dp[i] += dp[i - 2] + dp[i - 1]

    dp[i] %= mod
print(dp[n])

Measured memory_bytes: 8592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;

#define ll long long
#define db double
#define clr(a, b) memset(a, b, sizeof(a))

const int maxn = 5e5 + 10;
const int inf = 0x7ffffff;

int a[maxn], b[maxn];
void solve()
{
    int n;
    cin >> n;
    for (int i = 0; i < n-1;i++)
        cin >> a[i], b[a[i]]++;
    for (int i = 1; i <= n;i++)
        cout << b[i] << "\n";
}

int main()
{
    //freopen("out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    //cin >> T;
    while(T-- > 0)
        solve();

}

Measured memory_bytes: 5212
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e7+19;
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int main()
{
    int n,ans = 2<<29;
    scanf("%d",&n);
   for(int i = 0,x;i<n;++i)
   {
       cin>>x;
       ans = gcd(x,ans);
   }
   int y = 0;
   while(ans%2==0)ans/=2,y++;
   cout<<y<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	printf("%d\n",min(a,min(b,c))+min(d,e)-50);
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    if (n%2) cout << "No";
    else if (s.substr(0, n/2) == s.substr(n/2, n/2))
        cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main()
{
	char s[10000];
	int sum = 0;
	
	while(scanf("%s", s) != EOF){
		int len = strlen(s);
		
		for(int i = 0; i < len; i++){
			bool ok = false;
			char num[10000] = {0};
			int j = 0;
			while(s[i] >= '0' && s[i] <= '9'){
				num[j] = s[i];
				i++;
				j++;
				ok = true;
			}
			if (ok) {
				sum += atoi(num);
			}
		}
	}
	
	printf("%d\n", sum);
	
	return(0);
}

Measured memory_bytes: 992
#include <iostream>
#include <sstream>
#include <regex>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
//const int INF = 100100100;
const int INF = (1LL << 32);
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;

int n;
vector<int> a;


bool check(int index) {
	for (int i = index + 1; i < a.size(); i++) {
		if (a[index] < a[i]) {
			return true;
		}elif(a[index] > a[i]) {
			return false;
		}
	}
	return true;
}

signed main() {
	ios::sync_with_stdio(false);
	cin >> n;
	int ans = 0;
	rep(i, n) {
		int x;
		cin >> x;
		a.pb(x);
	}
	bool isInc = check(0);
	for (int i = 0; i < a.size()-1; i++) {
		if (isInc) {
			if (a[i] > a[i+1]) {
				ans++;
				isInc = check(i+1);
			}
		}
		else {
			if (a[i] < a[i+1]) {
				ans++;
				isInc = check(i+1);
			}
		}
	}
	cout << ans+1 << endl;
 	return 0;
}



Measured memory_bytes: 1400
import java.util.Scanner;

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

        String[] a = new String[H];
        for (int i = 0; i < H ; i++) {
            a[i] = sc.next();
        }

        for (int i = 0; i <= H + 1; i++) {
            if (i == 0 || i == H + 1) {
                for (int j = 0; j <= W + 1; j++) {
                    System.out.print("#");
                }
                System.out.println();
            }else{
                System.out.println("#" + a[i - 1] + "#");
            }
        }
    }
}


Measured memory_bytes: 20688
#include <stdio.h>
#define N 100
int selection(int *,int );

int main(){
  int i,num=0,num2[N],new;
  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%d",&num2[i]);
  }
  new=selection(num2,num);
  for(i=0;i<num;i++){
    if(i<num-1) printf("%d ",num2[i]);
    else printf("%d\n",num2[i]);
  }
  printf("%d\n",new);
  return 0;
}

int selection(int *num2,int num){
  int i,minj,j,cnt=0,temp;
  for(i=0;i<=num-1;i++){
    minj=i;
    for(j=i;j<=num-1;j++){
      if(num2[j]<num2[minj]){
	minj=j;
      }
    }
    temp=num2[i];
    num2[i]=num2[minj];
    num2[minj]=temp;
    if(num2[i]!=num2[minj]) cnt++;
  }
  return cnt;
}

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

int main() {
	// your code goes here
	int a,b,c,k;
	cin>>a>>b>>c>>k;
    int max_sum=0;
	
	while(k)
	{
		if(a)
		{
			max_sum+=1;
			a--;
		}
		else if(b)
		{
			max_sum+=0;
			b--;
	
		}
		else if(c)
		{
			max_sum+=-1;
			c--;
			
		}
		k--;
	}
	cout<<max_sum<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS

int main(int argc, char const *argv[])
{
	int n,k;
	char s[57];
	scanf("%d%d",&n,&k);
	scanf(" %s",s);
	s[k - 1] += 0x20;
	puts(s);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main(){
    ll n, W;
    cin >> n >> W;
    vector<ll> w(n), v(n);
    for(int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    vector<vector<ll>> dp(n+1,vector<ll>(W+1,0));
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= W; j++){
            if(j-w[i-1]>=0){
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
            }else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout << dp[n][W] << endl;

}


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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C;
    cin >> A >> B >> C;
    if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
        cout << 0 << endl;
    } else {
        cout << min({A * B, B * C, C * A}) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main(){
	long long H;
	cin >> H;
	int i = 0;
	long long sum = 0;
	while(H != 0){
		sum += pow(2,i);
		H /= 2;
		i++;
	}
	cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define LL long long
#define NUM 1000000007

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto& i : v)
    {
        cin >> i;
    }
    int num1 = 0, num2 = 0, num4 = 0;
    for (auto& i : v)
    {
        if (i % 4 == 0)
        {
            num4++;
        }
        else if (i % 2 == 0)
        {
            num2++;
        }
        else
        {
            num1++;
        }
    }
    if (num2 == 0 && num4 + 1 >= num1)
    {
        cout << "Yes" << endl;
        return 0;
    }
    if (num2 != 0 && num4 + 1 >= num1 + 1)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

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

int main(){
  int N, count = 0;
  cin >> N;
  vector<int> A(N);
  
  for (int i = 0; i < N; i++)
    cin >> A.at(i);
  
  while (true){
    int i;
    for (i = 0; i < N; i++){
      if (A.at(i) % 2 == 0)
        A.at(i) /= 2;
      else
        break;
    }
    
    if (i == N){
      count++;
      continue;
    }
    
    break;
    
  }
  cout << count << endl;
}
  


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

#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i]<<((i==a.size()-1)?"\n":" ");}}
int gcd(int a,int b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
int lcm(int a,int b){return a==0||b==0?0:a*b/gcd(a,b);}

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

void solve()
{
  vector<int> a;
  FOR(i,2,50100) if(prime(i)) a.push_back(i);
  int n;
  while(~scanf("%d",&n))
  {
    int l = *(lower_bound(a.begin(),a.end(),n)-1);
    int r = *(upper_bound(a.begin(),a.end(),n));
    printf("%d %d\n",l,r);
  }
}

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

Measured memory_bytes: 3296
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
int n,k,t,u,v,l,d[222];
main()
{
	cin>>n>>k>>t>>u>>v>>l;
	for(int i=0;i<n;i++)cin>>d[i];
	int id=0;
	double ans=0,p=0;
	for(int i=0;i<l;i++)
	{
		if(d[id]==i)
		{
			id++;
			p=min(p+t,(k+1.)*t);
		}
		if(p*v<1.0)
		{
			ans+=p+(1.0-p*v)/u;
			p=0;
		}
		else
		{
			ans+=1.0/v;
			p-=1.0/v;
		}
	}
	cout<<fixed<<setprecision(9)<<ans<<endl;
}



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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const ll INF = 1e18;
const int mod = 1e9+7;
const int MAX = 1e6;

// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

struct disjoint {
    vi root; // 各要素の根
    vi size; // 集合の高さ
    disjoint(int n) {
        root.resize(n);
        size.resize(n, 1);
        rep(i, n) {
            root[i] = i;
        }
    }
    int find(int x) {
        if (x == root[x]) return x;
        return root[x] = find(root[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (size[x] >= size[y]) {
            root[y] = x;
            size[x] += size[y];
        } else {
            root[x] = y;
            size[y] += size[x];
        }
    }
};

int n, m;

int main() {
    cin >> n >> m;
    disjoint f = disjoint(n+1);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        f.unite(a, b);
    }
    int ans = 0;
    rep(i, n+1) {
        // printf("root[%d] %d size[%d] %d\n", i, f.root[i], i, f.size[i]);
        ans = max(ans, f.size[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int r = floor(sqrt(n));
    cout << n << ":";
    while(n % 2 == 0) {
        n /= 2;
        cout << " 2";
    }
    for(int i = 3; i <= r; i += 2) {
        while(n % i == 0) {
            n /= i;
            cout << " " << i;
        }
    }
    if(r < n) cout << " " << n;
    cout << endl;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>void vcin(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    double ans = n * 2 * M_PI;


    co(ans);

    return 0;
}

Measured memory_bytes: 3792
n = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans += bl[al[i]-1]
    if 1 <= i and al[i] == al[i-1]+1:
        ans += cl[al[i-1]-1]

print(ans)


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	string s;
	cin >> s;
	int i = 0;
	while (i < s.size()) {
		if (s.substr(i, 2) != "hi")break;

		i += 2;
	}

	cout << (i == s.size() ? "Yes" : "No") << endl;



	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	rep(i,3) {
		if(n%10==7) {
			print("Yes");
			return 0;
		}
		n/=10;
	}
	print("No");

	return 0;
}


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

int main()
{
    //freopen("test.in","r",stdin);
    //freopen("test.ok","w",stdout);
    int64_t a,b;
    cin >> a >> b; 
    if (a==b) 
    for (int i=0;i<a;i++)
        cout << a;
    else if (a<b) 
    for (int i=0;i<b;i++)
        cout << a;
    else
    for (int i=0;i<a;i++)
        cout << b;
}

Measured memory_bytes: 256
import collections
n,k = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
y = set(x)
if len(y)<=k:
	print(0)
else:
	answer = 0
	c = collections.Counter(x).most_common()
	for j in range(-1,-(len(y)-k+1),-1):
		answer += c[j][1]
	print(answer)

Measured memory_bytes: 50556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		String c = scan.next();

		if (a.charAt(a.length() - 1) == b.charAt(0) && b.charAt(b.length() - 1) == c.charAt(0)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

}


Measured memory_bytes: 23252
#include <stdio.h>
#define N 25

typedef struct{

  int parent;
  int left;
  int right;

      }Node;

      int n;
Node in[N];

void init();
int sibling(int);
int depth(int);
int type(int);
int degree(int);
int height(int);

int main(){

  int i, id;

   init();

        scanf("%d", &n);

            for(i = 0; i < n; i++){
    scanf("%d", &id);
    scanf("%d %d", &in[id].left, &in[id].right);

          if(in[id].left == -1 && in[id].right == -1) continue;

                in[in[id].left].parent = id;
    in[in[id].right].parent = id;
    }

                for(i = 0; i < n; i++){
    printf("node %d: parent = %d, sibling = %d, ", i, in[i].parent, sibling(i));
    printf("degree = %d, depth = %d, height = %d, ", degree(i), depth(i), height(i));

    if(type(i) == 0){
      printf("root\n");
    } else if(type(i) == 1){
      printf("leaf\n");
    } else if(type(i) == 2){
      printf("internal node\n");
    }
                }
  return 0;
}

int depth(int num){
  int i;

    for(i = 0; in[num].parent != -1; i++){
      num = in[num].parent;
    }

         return i;
}

void init(){
  int i;

   for(i = 0; i < N; i++){
    in[i].parent = -1;
    in[i].left = -1;
    in[i].right = -1;
    }

        }




int type(int num){

  if(in[num].parent == -1){
   return 0;
    }

    if(in[num].left == -1 && in[num].right == -1){
    return 1;
    }

        return 2;

            }

int height(int num){
  int i;
  int heightLeft = -1, heightRight = -1;

      if(in[num].left != -1){
    heightLeft = height(in[num].left);
    }

          if(in[num].right != -1){
    heightRight = height(in[num].right);
    }

          heightLeft++;
          heightRight++;

          if(heightLeft > heightRight){
            return heightLeft;
          } else {
            return heightRight;
          }

}

int sibling(int num){

  if(in[num].parent == -1){
    return -1;
    }

    if(in[in[num].parent].left == num){
    return in[in[num].parent].right;
    } else {
    return in[in[num].parent].left;
    }

        }

int degree(int num){

  if(in[num].left == -1 && in[num].right == -1){
   return 0;
    }

    if(in[num].left == -1 || in[num].right == -1){
    return 1;
    }

        return 2;

             }

Measured memory_bytes: 612
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
// scanf("%d", &x); => std::cin >> x;
// printf("%d\n", x); => std::cout << x << "\n";

int main() {
    int n;
    scanf("%d", &n);
    int l[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &l[i]);
    }

    int count = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            if (i == j) continue;
            for (int k = j; k < n; k++) {
                if (i == k) continue;
                if (j == k) continue;
                if (l[i] == l[j] || l[j] == l[k] || l[i] == l[k]) continue;
                /* 三角形になるかどうか */
                int max = l[i];
                int mid = l[j];
                int midd = l[k];
                if (l[j] > max) {
                    max = l[j];
                    mid = l[i];
                    midd = l[k];
                }
                if (l[k] > max) {
                    max = l[k];
                    midd = l[i];
                    mid = l[j];
                }
                if (max < mid + midd) {
                    count++;
                    // printf("%d %d %d\n",max,mid,midd);
                }
            }
        }
    }

    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 3232
#include <stdio.h>
#include <math.h>
int main(void){
    int n;
    scanf("%d",&n);
    int m=(int)ceil((double)((-1+sqrt(1+8*n))/2));
    printf("%d\n",m);
    n-=m;
    while(n!=0){
        m--;
        if(n-m>=0){
            printf("%d\n",m);
            n-=m;
        }
    }
}







Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll K, N;
  cin >> K >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  ll end = A[N - 1];
  ll ans = K;
  for (int i = 0; i < N; i++) {
    ans = min(ans, end - A[i]);
    end = K + A[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
const int p = 1e9 + 7;
ll modpower(ll base, ll power, ll mod=p){
    ll ans =1;
    base%=mod;
    while(power){
        if(power&1){
            ans*=base;
            ans%=mod;
        }
        base*=base;
        base%=mod;
        power>>=1;
    }
    return ans;
}
vector<ll> fact;
vector<ll> invfact;
void computefactorial(int n){
    ++n;
    fact.resize(n);
    invfact.resize(n);
    fact[0]=1;
    for(int i=1;i<n;i++){
        fact[i]=i*fact[i-1];
        fact[i]%=p;
    }
    invfact[n-1]=modpower(fact[n-1],p-2);
    for(int i=n-2;i>=0;i--){
        invfact[i]=(i+1)*invfact[i+1];
        invfact[i]%=p;
    }
}
ll ncr(int n,int r){
    return fact[n]*invfact[n-r]%p * invfact[r]%p;
}
void solve(){
    int s;
    cin>>s;
    int n = 1;
    s-=3;
    ll ans = 0;
    while(s>=0){
        ans+=ncr(s+n-1, n-1);
        s-=3;
        n++;
    }
    cout<<ans%p<<"\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    computefactorial(1e6);
    solve();
}

Measured memory_bytes: 18748
#include<bits/stdc++.h>
using namespace std;
using lint = long int;
using P = pair<lint, lint>;
#define pb push_back

lint N, D, x, y, res = 0;
vector<P> p;

int main(){
    cin >> N >> D;

    for(int i = 0; i < N; i++){
        cin >> x >> y;
        if(x*x+y*y <= D*D) ++res;
        p.pb(P(x,y));
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 7416
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ull N;
    cin >> N;
    ull power = 1;
    ull m = 1000000007;
    for (ull i = 1; i <= N; ++i)
    {
        power = (power * i) % m;
    }
    cout << power << endl;
}

Measured memory_bytes: 3620
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int A,P;
	cin>>A>>P;
	cout<<(A*3+P)/2<<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n, m, x[100000], d[100000];

int main(int argc, char **argv) {
	cin >> n >> m;
	REP(i, m) cin >> x[i];
	sort(x, x+m);
	REP(i, m-1) d[i] = x[i+1] - x[i];
	sort(d, d+m-1);
	ll res = 0;
	REP(i, max((ll)0, m-n)) res += d[i];
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 5160
from itertools import chain,combinations, product
from copy import deepcopy

def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))

h, w, k = map(int, input().split())
C = [list(input()) for _ in range(h)]

pset = product(powerset(range(h)), powerset(range(w)))
ans = 0
for vert, hori in pset:
    D = deepcopy(C)
    for i in vert:
        for j in range(w):
            D[i][j] = 'r'
    for i in range(h):
        for j in hori:
            D[i][j] = 'r'
    count = sum(D[i].count('#') for i in range(h))
    if count == k:
        ans += 1
print(ans)

Measured memory_bytes: 9368
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 55
bool lis[N][N],v[N][N];
int a[N],b[N],n;

bool renketsu(){
    lol(u,n){
	int x=a[u],y=b[u];
	if(x<y)return false;
	if(x==y)continue;
	bool ok[N]={0};
	ok[x]=1;
	for(int i=x;i>y;i--){
	    if(ok[i]){
		for(int j=0;j<N;j++){
		    ok[j]|=v[i][j];
		}
	    }
	}
	if(ok[y])continue;
	else return false;
    }
    return true;
}

int F(int lim){
    lol(i,N)lol(j,N)v[i][j]=lis[i][j];
    
    if(renketsu())return 0;
    
    for(int k=1;k<lim;k++){
	
	for(int i=1;i<N;i++){
	    v[i][i%k]=true;
	}
	
	if(renketsu())return k;
	
	if(k==N-1)return -1;
    }
    return 0;
}

int main(){
    cin>>n;
    lol(i,n)cin>>a[i];
    lol(i,n)cin>>b[i];
    ll ans=0;
    int bef=N;
    while(true){
	int k=F(bef);
	if(k==-1){
	    cout<<"-1"<<endl;
	    return 0;
	}
	if(k==0)break;
	ans+=((ll)1<<k);
	bef=k;
	
	for(int i=1;i<N;i++){
	    lis[i][i%k]=true;
	}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

input = sys.stdin.readline


def I():
    return int(input())


@njit((i8,), cache=True)
def main(n):
    table = np.zeros(n, np.int64)

    for i in range(1, n):
        table[::i] += 1

    ans = 0
    for n in table[1:]:
        q, r = divmod(n, 2)
        ans += q * 2 + 1 * r

    return ans


N = I()

print(int(main(N)))


Measured memory_bytes: 122232