akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
    int a[5],temp;
    for(int i=0;i<5;i++)
        {
            cin>>a[i];
        }

    for(int i =0;i<5;i++)
        {
            for(int j=0;j<5;j++)
                {
                    if(a[i]>a[j])
                      {
                            temp = a[i];
                            a[i] = a[j];
                            a[j] = temp;
                      }
                }
        }

                for(int i=0;i<5;i++)
                {
                    if (i==4)
                        cout<<a[i]<<endl;
                    else
                        cout<<a[i]<<" ";
                }

                return 0;
}

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

int main(){
	string a;
	string b;
	cin>>a>>b;
	int n=a.size();
	int m=b.size();
	int dp[n+1][m+1];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			if(!i||!j)dp[i][j]=0;
			else if(a[i-1]==b[j-1])dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	
	string ans="";
	int i = n, j = m; 
    while (i > 0 && j > 0) 
    {
	    if (a[i-1] == b[j-1]) 
	    { 
		    ans=a[i-1]+ans;
		    i--; j--;   
	    }
	    else if (dp[i-1][j] > dp[i][j-1])i--; 
	    else j--; 
    }
	cout<<ans;
	return 0;
}


Measured memory_bytes: 35456
def solve(s, t):
    n = len(s)
    m = len(t)
    best = m
    for i in range(n-m+1):
        num = 0
        for j in range(m):
            if s[i+j] != t[j]:
                num += 1
        best = min(best, num)
    return best

s = input()
t = input()
print(solve(s, t))


Measured memory_bytes: 9040
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    --k;

    s[k] = tolower(s[k]);

    cout << s;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) {cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl;}

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}
bool operator<(const TRI&_)const{return(fi==_.fi)?((se==_.se)?(th<_.th):(se<_.se)):(fi<_.fi);}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

long long allxor(long long val) {
	return (val & 1LL) ? ((val & 3) == 1) : (val ^ (((val ^ 1) & 3) == 3));
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	ll a, b;
	cin >> a >> b;
	if(a == 0){
		cout << allxor(b) << "\n";
	}else{
		cout << (allxor(a-1) ^ allxor(b)) << "\n";
	}
    return 0;
}

Measured memory_bytes: 256
s = list(input())
f = int(''.join(s[:2]))
r = int(''.join(s[2:]))
yymm = 0
mmyy = 0
if 0 <= f and f <= 99:
    if 1<=r and r<= 12:
        yymm = 1
if 1<=f and f<= 12:
    if 0 <= r and r <= 99:
        mmyy = 1
if mmyy == 1 and yymm == 1:
    print('AMBIGUOUS')
elif mmyy == 0 and yymm == 1:
    print('YYMM')
elif mmyy == 1 and yymm == 0:
    print('MMYY')
else:
    print('NA')

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

int main()
{
  long nAnum, nBnum, nXpos;
  cin >> nAnum >> nBnum >> nXpos;

  long nDivHigh = nBnum / nXpos;
  long nDivLow;

  if (nAnum - 1 < 0)
  {
    nDivHigh++;
    nDivLow = 0;
  }
  else
    nDivLow = (nAnum - 1) / nXpos;

  cout << (nDivHigh - nDivLow) << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
#define rint register int
#define rep(i,l,r) for(rint i=l;i<=r;i++)
#define per(i,l,r) for(rint i=l;i>=r;i--)
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fir first
#define sec second
#define mset(s,t) memset(s,t,sizeof(s))
template<typename T1,typename T2>void ckmin(T1 &a,T2 b){if(a>b)a=b;}
template<typename T1,typename T2>void ckmax(T1 &a,T2 b){if(a<b)a=b;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
int read(){
  int x=0,f=0;
  char ch=getchar();
  while(!isdigit(ch))f|=ch=='-',ch=getchar();
  while(isdigit(ch))x=10*x+ch-'0',ch=getchar();
  return f?-x:x;
}
const int N=1e6+5;
const int mod=1e9+7;
ll dp[N][2][2];
int n;
int main(){
  cin>>n;
  dp[0][0][0]=1;
  for(int i=1;i<=n;i++){
    dp[i][0][0]=8ll*dp[i-1][0][0]%mod;
    dp[i][1][0]=(9ll*dp[i-1][1][0]+dp[i-1][0][0])%mod;
    dp[i][0][1]=(9ll*dp[i-1][0][1]+dp[i-1][0][0])%mod;
    dp[i][1][1]=(10ll*dp[i-1][1][1]+dp[i-1][0][1]+dp[i-1][1][0])%mod; 
  }
  printf("%lld\n",dp[n][1][1]);
}

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

int main(void) {
    int N, X;
    cin >> N >> X;
    vector<int> m(N);
    int ans = N;
    for (int i = 0; i < N; ++i) {
        cin >> m[i];
        X -= m[i];
    }
    sort(m.begin(), m.end());
    for (;;) {
        if (X < m[0]) {
            break;
        }
        X -= m[0];
        ++ans;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
static const int INFTY = (1<<21);

int main(){
    long long N, K;
    cin >> N >> K;
    if(N%K > (K-N%K)){
        cout << K-(N%K) << endl;
    }
    else{
        cout << N%K << endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

vector<ll> fac(202000), finv(202000), inv(202000);
void initcom(){
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  for(int i=2; i<202000; i++){
    fac[i] = (fac[i-1]*i) % mod;
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll nCr(ll n, ll k){
  if(n<k) return 0;
  if(n<0 || k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main(){
  initcom();
  ll N, K; cin >> N >> K;
  ll ans = 0;
  vector<ll> sums(N+2,0);
  rep(i,N+1) sums[i+1] = sums[i] + i+1;
  //rep(i,5) cout << sums[i] << endl;
  ll maxi = N;
  ll mini = 0;
  for(ll k=0; k<=N; k++){
    //out << maxi << " " << mini << endl;
    if(k>=K-1) {
      ans += maxi+1-mini;
      //ans -= mini;
      ans += mod;
      ans %= mod;
      //cout << ans << endl;
    }
    maxi += N-k-1;
    mini += k+1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9544
#Coding: Utf-8
A=[]
B=[]
place=count=total=0

for i in range(5):
    A.append(input())
    place=A[i]
    total=total+int(A[i])
    if int(place[-1])!=0:
        B.append(int(place[-1]))
B.sort()
for j in range(1,len(B)):
    count=count+(10-B[j])

print(total+count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

string S;
string A;
int N;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> N;
	cin >> S;

	A.resize(S.size());

	int i;
	FOR(s,S.size()) {
		i = S[s]-'A';
		i+=N;
		if(i>=26) {
			i-=26;
		}
		A[s] = 'A'+i;
	}

	cout << A <<endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

int H, W, K;

int erase(vector<vector<int>> &board) {
    int cnt = 0;
    for (int i = 0; i < H; ++i) {
        for (int l = 0; l < W; ++l) {
            int r = l;
            while (r < W && board[i][l] && board[i][l] == board[i][r])
                r++;
            if (r - l >= K) {
                cnt += (r - l) * board[i][l];
                for (int j = l; j < r; ++j)
                    board[i][j] = 0;
            }
        }
    }
    return cnt;
}

void fall(vector<vector<int>> &board) {
    for (int i = 0; i < W; ++i) {
        while (true) {
            bool isswaped = false;
            for (int j = 0; j < H - 1; ++j) {
                if (!board[j][i] && board[j + 1][i]) {
                    swap(board[j][i], board[j + 1][i]);
                    isswaped = true;
                }
            }
            if (!isswaped)
                break;
        }
    }
}

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

    cin >> H >> W >> K;
    vector<vector<int>> board(H, vector<int>(W));
    for (int i = H - 1; i >= 0; --i) {
        for (int j = 0; j < W; ++j) {
            char c;
            cin >> c;
            board[i][j] = c - '0';
        }
    }

    int ans = 0;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            auto cboard = board;
            cboard[i][j] = 0;
            fall(cboard);
            int point = 0, cnt = 0, turn = 0;
            while ((cnt = erase(cboard)) > 0) {
                point += cnt * (1 << turn);
                fall(cboard);
                turn++;
            }
            ans = max(ans, point);
        }
    }

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


Measured memory_bytes: 256
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}

int main()
{
    ios;
    int r;
    cin>>r;
    cout<<r*r<<endl;



}














Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<cstring>
#include<queue>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<cmath>
using namespace std;
typedef pair< int , int > Pi;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define INF (1 << 25)
#define fr first
#define sc second
#define numof(a)  (sizeof (a) / sizeof *(a))
#define fillall(a,b) fill_n( a , numof(a) , b )
#define fillall_2(a,b) fill( (int*) a , (int*)(a + numof(a)), b )
#define ALL(a) (a).begin() , (a).end()
#define RALL(a) (a).rbegin() , (a).end()
#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reps(i,0,n)
int main(){
  int data[800][3],d[400],n,m;
  fillall_2(data,0);
  fillall(d,0);
  cin >> n >> m;
  rep(i,m) rep(j,3){
    cin >> data[i][j];
  }
  rep(i,n) rep(j,m){
    d[data[j][1]] = max(d[data[j][1]],d[data[j][0]] + data[j][2]);
  }
  cout << d[n - 1] << endl;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld double
#define mp make_pair
#define vl vector<ll> 
#define ll long long int
#define pl pair<ll, ll>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
ll fact[(ll)(1e6+100)];
ll a, b, n;
ll power(ll a, ll b)
{
    if(b==0)
    return 1%MOD;
    if(b%2==1)
    return a*(power(a, b-1))%MOD;
    ll pow2=power(a, b/2);
    return pow2*pow2%MOD;
}
void solve()
{
    ll n;
    cin>>n;
    vl cost(n);
    forr(i, n)
    cin>>cost[i];
    if(n==1||!n)
    {
        cout<<0<<endl;
        return;
    }
    vl dp(n, INT_MAX);
    dp[0]=0;
    dp[1]=abs(cost[1]-cost[0]);
    for(ll i=2; i<n; i++)
    {
        dp[i]=min(dp[i-1]+abs(cost[i]-cost[i-1]), dp[i-2]+abs(cost[i]-cost[i-2]));
    }
    cout<<dp[n-1];
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 1792
#169A
#A*Bを整数として出力せよ。
#1．入力を受け取ること
a,b=map(int,input().split())
# print(a, b)

#2．受け取った入力値を使って、適切に処理すること
answer=a*b

#3．計算した結果を出力すること
print(answer)






Measured memory_bytes: 9064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	string s;
	cin>>s;
	rep(i,4-1)if(s.at(i)==s.at(i+1)){
		cout<<"Bad"<<endl;
		return 0;
	}
	cout<<"Good"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <iomanip>
using namespace std;
#define P(x) cout << x << endl
#define rep(i,n) for(long long int i=0;i<n;i++)
int main(){
    long long int n;
    long long int m=0,a=0,r=0,c=0,h=0;
    string str;
    cin>>n;
   rep(i,n){
       cin >> str;
       if(str[0] =='M') m++;
       else if(str[0] =='A') a++;
       else if(str[0] =='R') r++;
       else if(str[0] =='C') c++;
       else if(str[0] =='H') h++;
   }
unsigned long long int  ans =m*a*(r+c+h) + m*(r*c+r*h+c*h) + a*r*(c+h) + a*c*h+r*c*h;
  P(ans);
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

    public static void main(String[] args) {

        //標準入力
        Scanner sc = new Scanner(System.in);

        //変数
        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();

       if (d <= t * s){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35688
#include <iostream>

int sum_of_digits(int n) {
    int sum;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int N;
    std::cin >> N;

    std::cout << (N % sum_of_digits(N) == 0 ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

k,a,b = MI()

if a+2 >= b:
    print(1+k)
elif a >= k+2:
    print(1+k)
elif (k-a+1)%2 == 0:
    print((k-a+1)//2*(b-a)+a)
else:
    print((k-a+1)//2*(b-a)+a+1)


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

int main()
{
while(1){
	char s[100];
	int a=0,b=0,i,j;

	cin >> s;
if(s[0]=='0'&&s[1]=='\0')break;

		if(s[0]=='A')a=a-1;
		if(s[0]=='B')b=b-1;	
for(i=0;s[i]!='\0';i++){
		if(s[i]=='A')a=a+1;
		
		if(s[i]=='B')b=b+1;
		
}
if(a>b){a=a+1;
}else{ b=b+1;}


cout<<a<<" "<<b<<endl;
}
return 0;

}

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

using namespace std;

struct Bipartite_Matching {
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp;

  Bipartite_Matching(int n) {
    timestamp = 0;
    graph.resize(n);
    alive.assign(n, 1);
    used.assign(n, 0);
    match.assign(n, -1);
  }

  void add_edge(int u, int v) {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int v) {
    used[v] = timestamp;
    for(int i = 0; i < graph[v].size(); i++) {
      int u = graph[v][i], w = match[u];
      if(alive[u] == 0) continue;
      if(w == -1 || (used[w] != timestamp && dfs(w))) {
        match[v] = u;
        match[u] = v;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching() {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return (ret);
  }
};


int main() {
  int N, A, B, X[800];
  bool v[800] = {};
  int ret = 0;
  cin >> N >> A >> B;
  for(int i = 0; i < N; i++) {
    int y;
    cin >> X[i] >> y;
    X[i] -= y;
    if(abs(X[i]) <= A || (B <= abs(X[i]) && abs(X[i]) <= 2 * A)) {
      v[i] = true;
      ++ret;
    }
  }
  Bipartite_Matching flow(N);
  for(int i = 0; i < N; i++) {
    if(v[i]) continue;
    for(int j = 0; j < i; j++) {
      if(v[j]) continue;
      if(abs(X[i] + X[j]) <= A || (B <= abs(X[i] + X[j]) && abs(X[i] + X[j]) <= 2 * A)) {
        flow.add_edge(i, j);
      }
    }
  }
  cout << flow.bipartite_matching() + ret << endl;
}



Measured memory_bytes: 3412
def abc():
    AH,AS,BH,BS=map(int,input().split(' '))

    while(AH>0 and BH>0 ):
        BH=BH-AS
        AH=AH-BS
    if(BH<=0 and AH+BS>0):
        print("Yes")
    else:
        print("No")
abc()


Measured memory_bytes: 9172
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
long long x[200002],d[200002],c[200002];

int lis(int n){
	int i,j,I;
/*
	for(i=-1;I=0,++i<n;d[i]=I+1)
		for(j=i-1;~j;j--)
			if(x[j]<x[i]&&I<d[j])I=d[j];
*/
	// http://stackoverflow.com/questions/6129682/longest-increasing-subsequenceonlogn
	int sz = 1;
	c[1] = x[0];
	d[0] = 1;
	for(i=0;++i<n;){
		if(x[i] < c[1]){
			c[1] = x[i];
			d[i] = 1;
		}else if(x[i] > c[sz]){
			c[sz+1] = x[i];
			d[i] = sz+1;
			sz++;
		}else{
			int k = lower_bound(c,c+sz,x[i])-c;
			c[k] = x[i];
			d[i] = k;
		}
	}
	for(i=j=0;i<n;i++)
		if(d[i]>d[j])j=i;
	return d[j];
}

int main(){
	long long x1,y1,x2,y2;
	int n,xf=1,yf=1;
	scanf("%lld%lld%lld%lld%d",&x1,&y1,&x2,&y2,&n);
	if(x1>x2)swap(x1,x2),xf=-1;
	if(y1>y2)swap(y1,y2),yf=-1;
	vector<pair<long long,long long>>v;
	for(int i=0;i<n;i++){
		long long x,y;
		scanf("%lld%lld",&x,&y);
		if(x1<=x&&x<=x2 && y1<=y&&y<=y2)v.emplace_back(x*xf,y*yf);
	}
	sort(v.begin(),v.end());
	n=0;
	for(auto &e:v)x[n++]=e.second;
	n=n?lis(n):0;
	printf("%.15f\n",100.0*(x2-x1+y2-y1)-20*n+5*(n+(n>=min(x2-x1,y2-y1)+1))*M_PI);
}

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

string s,t;
int m,n;
int dp[3010][3010];




int main()
{
    cin>>s>>t;
    m=s.length();
    n=t.length();

    for(int i=0;i<=m;i++)
        dp[i][0]=0;
    for(int i=0;i<=n;i++)
        dp[0][i]=0;


    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(s[i-1]==t[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                if(dp[i-1][j]>=dp[i][j-1])
                    dp[i][j]=dp[i-1][j];
                else
                    dp[i][j]=dp[i][j-1];
            }
        }
    }
    int cnt=dp[m][n];
    string ans="";

    while(cnt)
    {
        if(s[m-1]==t[n-1])
        {
            cnt--;
            ans=s[m-1]+ans;
            m--,n--;
        }
        else
        {
            if(dp[m-1][n]>=dp[m][n-1])
                m--;
            else
                n--;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 35584
<?php
$str = "#.";
while (true) {
        fscanf(STDIN,"%d %d",$h,$w);
        if ($h === 0 && $w === 0) break;
        $res = "";
        for ($i = 0; $i < $h; $i++) {
                for ($j = 0; $j < $w; $j++) {
                        $res .= $str[($i+$j)%2];
                }
                $res .= PHP_EOL;
        }
        echo $res, PHP_EOL;
}

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

int main() {
  int x,a,b;
  cin >> x >> a >> b;
  if(b-a<=0){
    cout << "delicious" << endl;
  }else{
    if(b-a<=x){
      cout << "safe" << endl;
    }else{
      cout << "dangerous" << endl;
    }
  }
}

Measured memory_bytes: 764
from collections import deque

b = deque()
n=int(input())
a=[i for i in input().split()]
ans=0
for i in range(n):
    if(i%2==0):
        b.append(a[i])
    else:
        b.appendleft(a[i])
if(n%2==1):
    b.reverse()
for i in b:
    print(i+' ',end="")

Measured memory_bytes: 21316
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

inline int add(int a, int b, int mod = MOD) {
  a += b; return a >= mod ? a - mod : a;
}
inline int sub(int a, int b, int mod = MOD) {
  a -= b; return a < 0 ? a + mod : a;
}
inline int mul(int a, int b, int mod = MOD) {
  return int((long long) a * b % mod);
}
inline int power(int base, long long ex, int mod = MOD) {
  int res = 1;
  for (; ex > 0; ex >>= 1) {
    if (ex & 1) res = mul(res, base, mod);
    base = mul(base, base, mod);
  }
  return res;
}
inline int inv(int a, int mod = MOD) {
  return power(a, mod - 2, mod);
}
inline int mdiv(int a, int b, int mod = MOD) {
  return mul(a, power(b, mod - 2,  mod));
}
inline void adds(int &a, int b, int mod = MOD) {
  a += b; if (a >= mod) a -= mod;
}
inline void subs(int &a, int b, int mod = MOD) {
  a -= b; if (a < 0) a += mod;
}
inline void muls(int &a, int b, int mod = MOD) {
  a = int((long long) a * b % mod);
}
inline void mdivs(int &a, int b, int mod = MOD) {
  a = mdiv(a, b, mod);
}
vector<int> fact,ifact;
void prep_fact(int mx = 1e6 + 40) {
  fact.assign(mx,0);
  ifact.assign(mx,0);
  fact[0] = 1;
  for (int i = 1; i < mx; ++i) fact[i] = mul(i, fact[i - 1]);
  ifact[mx - 1] = inv(fact[mx - 1]);
  for (int i = mx - 1; i > 0; --i) ifact[i - 1] = mul(i, ifact[i]);
}
inline int ncr(int n, int r) {
  if (n < r || r < 0 || n < 0) return 0;
  return mul(fact[n], mul(ifact[n - r], ifact[r]));
}

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   int sm = 0;
   vector<int> A(n);
   for(int i = 0; i < n; ++i){
      cin >> A[i];
      adds(sm,A[i]);
   }
   int ans = 0;
   for(int i = 0; i < n; ++i){
      subs(sm,A[i]);
      adds(ans,mul(A[i],sm));
   }
   cout << ans << '\n';
   return 0;
} 

Measured memory_bytes: 4760
s = input()
L = len(s)



flag = 1
for i in range(L):
  if i%2 == 0:
    if s[i] == "L":
      flag = 0
      break
  if i%2 == 1:
    if s[i] == "R":
      flag = 0
      break

if flag == 0:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3060
def main():
    def check(p):
        # 積めた荷物の数
        i = 0
        # トラックの数だけ試行
        for _ in range(k):
            # 現在のトラックの重量
            s = 0
            while s + w[i] <= p:
                # 積める場合は積んで次の荷物へ
                # 積めない場合は次のトラックへ
                s += w[i]
                i += 1
                if i == n:
                    return n
        return i

    def solve():
        left, right = 0, 100000 * 10000 + 1
        while left < right:
            mid = (left + right) // 2
            if n <= check(mid):
                right = mid
            else:
                left = mid + 1
        return left

    n, k = [int(i) for i in input().split()]
    w = [int(input()) for _ in range(n)]
    ans = solve()
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 9564
N, K = map(int, input().split())
S = input()
countList = []

isOne = True
cnt = 0
ans = 0
for i in S:
    if isOne:
        if i == "0":
            countList.append(cnt)
            isOne = False
    else:
        if i == "1":
            countList.append(cnt)
            isOne = True
    cnt += 1
countList.append(cnt)
if(isOne == False):
    countList.append(cnt)
K = min(len(countList)//2, K)
for i in range(len(countList)):
    if i*2+2*K<len(countList):
        if i*2-1 < 0:
            ans = max(ans, countList[i*2+2*K])
            continue
        ans = max(ans, countList[i*2+2*K]-countList[i*2-1])
    else:
        break

if len(countList)==1:
    ans = countList[0]
print(ans)

Measured memory_bytes: 7164
import java.util.Scanner;
import static java.lang.Math.PI;
class Main {
	public static void main(String[] arg){
		Scanner in = new Scanner(System.in);
		double  x = in.nextDouble();	
		System.out.printf("%.5f %.5f",x*x*Math.PI,2*x*Math.PI);
	}
}

Measured memory_bytes: 18900
#include "bits/stdc++.h"
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define INF 100000000
typedef long long ll;

int n, k;
int field[5000][5000];

using namespace std;

int main()
{
    cin >> n>>k;
    int k2 = k * 2;
    int k4 = k * 4;
    int ans = 0;
    REP(i, n) {
        int x, y;
        char str;
        cin >> x >> y >> str;
        if (str == 'B')x += k;
        x %= k2;
        y %= k2;
        field[x][y]++;
    }

    REP(x, k2) {
        REP(y, k2) {
            field[x + k2][y + k2] = field[x][y + k2] = field[x + k2][y] = field[x][y];
        }
    }

    REP(x, k4) {
        REP(y, k4) {
            field[x][y] += (x ? field[x - 1][y] : 0) + (y ? field[x][y - 1] : 0) - (x&&y ? field[x - 1][y - 1] : 0);
        }
    }

    REP(x, k2) {
        REP(y, k2) {
            ans = max(ans, field[x + k][y + k] - field[x][y + k] - field[x + k][y] + field[x][y] + field[x + k2][y + k2] - field[x + k][y + k2] - field[x + k2][y + k] + field[x + k][y + k]);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 80128
#include<iostream>
using namespace std;
int main()
{
  int A,B,C,D;
  cin >>A >>B >>C >>D;
  int ta, ao;
  ta = C/B;
  ao = A/D;
  if (C%B!=0)
    ta++;
  if (A%D!=0)
    ao++;
  
  if ( ta <= ao ){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    string S, T;

    cin >> S >> T;

    string t = T.substr(0, T.size()-1);
    if( S == t ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3600
import sys
n = int(input())
s = list(map(int, input().split()))
c = 0
a = 'a'
def merge(A, left, mid, right):
    global c
    L = A[left:mid]
    R = A[mid:right]
    L.append(sys.maxsize)
    R.append(sys.maxsize)
    i = 0
    j = 0
    for k in range(left, right):
        c += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def mergesort(A, left, right):
    if left+1 < right:
        mid = (left+right)//2
        mergesort(A, left, mid)
        mergesort(A, mid, right)
        merge(A, left, mid, right)

mergesort(s, 0, n)

for i in range(n-1):
    print(s[i], end=' ')
print(s[n-1])
print(c)


Measured memory_bytes: 61656
N = int(input())
plan = [[0]*3 for i in range(N+1)]
for i in range(1,N+1):
    plan[i][0],plan[i][1],plan[i][2] = map(int,input().split())

flag = 0

for i in range(N):
    dt = plan[i+1][0] - plan[i][0]
    dist =  abs(plan[i+1][1]-plan[i][1]) + abs(plan[i+1][2]-plan[i][2])
    if dt < dist or dt%2 != dist%2:
        print("No")
        flag = 0
        break
    else:
        flag = 1

if flag == 1:
    print("Yes")


Measured memory_bytes: 19572
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n, k;
    cin >> n >> k;
    int max = (n - 1) * (n - 2) / 2;
    if (k > max) {
        cout << -1 << "\n";
    } else {
        int t = max - k;
        cout << n - 1 + t << "\n";
        for (int i = 2; i <= n; ++i) {
            cout << 1 << " " << i << "\n";
        }
        int m = 0;
        if (t != 0) {
            for (int i = 2; i <= n; ++i) {
                for (int j = i + 1; j <= n; ++j) {
                    if (i != j) {
                        cout << i << " " << j << endl;
                        m++;
                    }
                    if (m == t)
                        break;
                }
                if (m == t)
                    break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main(){
	auto z=readln.split.to!(int[]),a=z[0],b=z[1],c=z[2];
	if(a+b<=a+c&&a+b<=b+c)writeln(a+b);
	else if(a+c<=a+b&&a+c<=b+c)writeln(a+c);
	else if(b+c<=a+b&&b+c<=a+c)writeln(b+c);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(){
  int64_t x,y;
  cin >>  x >> y;
  int64_t d  = y/x;
  int64_t ans = 1,num=1;
  while(num*2<=d){
    num*=2;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), output("\n"))
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	ll ans = INFLL;
	vector<ll> sum(n+1);
	sum[0] = 0;
	rep(i, n){
		ll d;
		cin >> d;
		sum[i+1] = sum[i] + d;
	}
	rep(i, n){
		chmin(ans, abs(sum[n]-sum[i]*2));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld long double
    #define ff first
    #define ss second
    #define pb push_back
    #define mp make_pair
    #define MOD 1000000007
    #define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
    int main()
    {
         FAST;
         ll n,m;
         cin >> n >> m;
         multiset<ll> s;
         for(ll i=0;i<n;i++)
         {
              ll x;
              cin>>x;
              s.insert(x);
         }
         while(m--)
         {
             if(s.size()==0)   continue;
             auto it = s.end();
             it--;
             ll temp = *it;
             s.erase(it);
             temp=temp/2;
             if(temp)   s.insert(temp);
         }
         ll ans = 0;
         for(auto X:s)   ans+=X;
         cout<<ans;
    }

Measured memory_bytes: 4992
a,b,n=map(int,input().split())
d=((a*(n))//b)-(a*((n)//b))
e=((a*(n-1))//b)-(a*((n-1)//b))
f=0
if b < n:
    f=((a*(b-1))//b)-(a*((b-1)//b))
print(max(d,e,f))

Measured memory_bytes: 61868
import math
n = int(input())
ans = 10**10
for a in range(math.ceil(math.sqrt(n)), 0, -1):
    if n % a == 0:
        b = n//a
        # if ans > max(len(str(a)), len(str(b))):
        ans = max(len(str(a)), len(str(b)))
        break

print(ans)


Measured memory_bytes: 38512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}


//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll a,b,c,x,y;
cin>>a>>b>>c>>x>>y;
ll ans=infll;
for(ll i=0;i<=200000;i++){
    ll tmp=i*2*c+seinomi((x-i)*a)+seinomi((y-i)*b);
    chmin(ans,tmp);
}
cout<<ans<<endl;
}








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

int main(void) {
	char s[100], p[100], cmp[100];
	bool frag = false;
	int lens, lenp;
	scanf("%s\n%s", &s, &p);
	lens = strlen(s);
	lenp = strlen(p);
	for (int i = 0; i < lens; i++) {
		for (int j = 0; j < lenp; j++) {
			cmp[j] = s[(i + j) % lens];
		}
		cmp[lenp] = '\0';
		frag = !strcmp(cmp, p);
		if (frag) { 
			//printf("%s:%s", cmp, p);
			break; }
	}

	if (frag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 2744
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ctime>
#include <set>
#include <sstream>
#include <bitset>
#include <queue>
#define ll long long
using namespace std;

int main() {
    string s;
    cin>>s;
    vector<int> r;
    int j = 1;
    for (int i = 0; i <= 200005; i++) {
        j = (j * 10) % 2019;
        r.push_back(j);
    }
    unordered_map<int, int>mp;
    int ans = 0;
    j = 0;
    mp[0] = 1;
    for (int i = 0; i < s.length(); i++) {
        int k = r[s.length() - i - 1];
        j += (k * (s[i] - '0'));
        j = j % 2019;
        ans+=mp[j];
         mp[j]++;
    }
//    ans+=mp[j];
    cout<<ans;
}


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

int main(){
	
	int n; cin>>n;
	vector<pair<int,int>> ba(n);
	for(int i=0; i<n; i++){
		cin>>ba.at(i).second>>ba.at(i).first;
		
	}
	sort(ba.begin(),ba.end());
	ll now{};
	for(int i=0; i<n; i++){
		now += ba.at(i).second;
		if(now > ba.at(i).first){
			cout << "No" << endl;
			return 0;
		}
		
		
	}
	cout << "Yes" << endl;
	
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    998244353;
ll fn(ll x)
{
	ll cnt=0;
	for(ll i=2;i*i<=x;i++)
	{
		if(x%i==0)
		 {
		 	ll z=x;
		 	while(z%i==0)
		 	z/=i;
		   if(z%i==1)
		   cnt++;
		   if(i*i!=x)
		   {

		 	z=x;
		 		while(z%(x/i)==0)
		 	z/=(x/i);
		 if(z%(x/i)==1)
		 cnt++;}
		 	
		 	
}
	}
	return cnt;
}

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

ll ans=1;
ans+=fn( n);

for(ll i=2;i*i<=n-1;i++)
{
	if((n-1)%i==0)
	{

	ans++;
	if(i*i!=n-1)
	ans++;}
}
cout<<ans+(n!=2);
return 0;

}


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

int main(void){
   int i=0,l,t=0;
   char str[101];
   scanf("%s",str);

   l=strlen(str);
   while(1){
      if(str[i]!=str[l-i-1])t++;
      if((i+1)*2>=l)break;
      i++;
   }
   printf("%d\n",t);
   return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n;
  cin >> n;
  vector<P> r(n+1,make_pair(-1,-1)),b(n);
  rep(i,n)cin >> r[i+1].first >> r[i+1].second;
  rep(i,n)cin >> b[i].first >> b[i].second;
  sort(ALL(r));
  sort(ALL(b));
  ll res = 0;
  rep(i,n){
    int pos = 0;
    rep(j,n){
      if(r[j+1].first < 0)continue;
      if(r[j+1].first >= b[i].first)break;
      if(r[j+1].second > r[pos].second && r[j+1].second < b[i].second)pos = j+1;
    }
    if(r[pos].first >= 0 && r[pos].first < b[i].first && r[pos].second < b[i].second){
      res++;
      r[pos] = make_pair(-1,-1);
    }
  }
  cout << res << endl;
  
  



  return 0;
}

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

int main() {
  char c;
  cin >> c;
  
  if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }

}

Measured memory_bytes: 3604
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define sz size()
#define pb push_back
#define print(x) cout << x << endl
ull a,b,c,d,n,m;
ull ans = 0;
ull dp[1001][1001];
vector<ull> v;

int main(){
  cin >> a >> b >> c >> d;
  if(a <= c && c <= b){
    if(b <= d){
      ans = b-c;
    }else{
      ans = d-c;
    }
  }else if(c <= a && a <= d){
    if(d <= b){
      ans = d-a;
    }else{
      ans = b-a;
    }
  }
  print(ans);
  return 0;
}


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

int main(){
	
	int i=1, n,x;

	scanf("%d", &n);
	while (1){
		x = i;
		if (x % 3 == 0){
			printf(" %d", i);
		}
		else{
			while (1){
				if (x % 10 == 3){
					printf(" %d", i);
					break;
				}
				x /= 10;
				if (!x)break;
			}
			
		}

		if (++i > n) break;
	}

	printf("\n");

	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    double n; cin >> n;
    double x = n / 3.0;
    cout << fixed << setprecision(15) << x*x*x << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, D = list(map(int, sys.stdin.buffer.readline().split()))
X, Y = list(zip(*[map(int, sys.stdin.buffer.readline().split()) for _ in range(N)]))

X = np.array(X, dtype=int)
Y = np.array(Y, dtype=int)

ans = (np.sqrt(X**2 + Y**2) <= D).sum()
print(ans)


Measured memory_bytes: 125040
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, s);
    bool c = false;
    For(i, (int)s.size()){
        if(s[i] == 'C') c = true;
        if(s[i] == 'F' && c){
            Cout("Yes");
            return 0;
        }
    }
    Cout("No");
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        a[i] -= (i+1);
    }
    sort(a.begin(),a.end());
    int x;
    if(n%2 == 1)x = a[n/2];
    else x = (a[n/2 - 1] + a[n/2])/2;
    int ret = 0;
    rep(i,n){
        ret += abs(a[i] - x);
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 4824