akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    string s;
    cin >> s;
    int n = s.length();
    if(s[0] != 'A'){
        cout << "WA\n";
        return 0;
    }
    int p = -1;
    for(int i = 0; i < n; ++i){
        if(s[i] == 'C'){
            if(p != -1){
                cout << "WA\n";
                return 0;
            }
            if(i <= 1 || i == n - 1){
                cout << "WA\n";
                return 0;
            }
            p = i;
        }
    }
    if(p == -1){
        cout << "WA\n";
        return 0;
    }
    for(int i = 1; i < n; ++i){
        if(i == p)  continue;
        if('A' <= s[i] && s[i] <= 'Z'){
            cout << "WA\n";
            return 0;
        }
    }
    cout << "AC\n";
}

Measured memory_bytes: 3620
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 2000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,b[maxn],cnt[maxn],nw;
vector <int> ans;

inline void del(int x){rep(i,x,nw) b[i]=b[i+1];}

int main()
{
	n=read(); rep(i,1,n) b[i]=read();
	rep(x,1,n)
	{
		nw=n-x+1;
		per(i,n,1) if(b[i]==i) {ans.pb(i),del(i); break;}
	}
	if(ans.size()!=n) puts("-1");
	else per(i,(int)ans.size()-1,0) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 3736
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
 
int main()
{
    char str[90];
     
    while( fgets( str, 81, stdin ) != 0 ){
        while( 1 ){
            for( int i = 0; i < strlen( str ); i++ ){
                if( isalpha( str[i] ) ) str[i]++;
                 
                if( str[i] > 'z' ){
                    str[i] = 'a';
                }
            }
             
            if( strstr( str, "the" ) != NULL || strstr( str, "this" ) != NULL || strstr( str, "that" ) != NULL ) break;
        }
         
        std::cout << str;
    }
 
    return 0;
}

Measured memory_bytes: 3020
import Control.Monad
import Data.List

func::Int->Int
func 0 = 0
func 1 = 0
func n = div (n * (n-1)) 2

main::IO ()
main = do
    n <- readLn
    xs <- replicateM n getLine
    -- let tmp = map length $ group $ map sort xs
    let tmp = map length $ group $ sort $ map sort xs
    print $ sum $ map func tmp

Measured memory_bytes: 114044
#include <iostream>
#define mod 1000000000+7;
typedef long long ll;
using namespace std;
 
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	ll a; cin >> a;
	cout << a+a*a+a*a*a << "\n";	
 
}

Measured memory_bytes: 3612
from collections import deque

H, W = map(int, input().split())
maze = [input() for _ in range(H)]


def bfs(maze, visited, sh, sw, H, W):
    q = deque([(sh, sw)])
    visited[sh][sw] = 0
    M = 0
    while q:
        h, w = q.popleft()
        for dh, dw in ((0, 1), (0, -1), (1, 0), (-1, 0)):
            nh = h + dh
            nw = w + dw
            if 0 <= nh < H and 0 <= nw < W:
                if maze[nh][nw] == "." and visited[nh][nw] == -1:
                    visited[nh][nw] = visited[h][w] + 1
                    q.append((nh, nw))
                    if visited[nh][nw] > M:
                        M = visited[nh][nw]

    return M


ans = 0
for h in range(H):
    for w in range(W):
        if maze[h][w] == "#":
            continue
        visited = [[-1] * W for _ in range(H)]
        tmp = bfs(maze, visited, h, w, H, W)
        if tmp > ans:
            ans = tmp
print(ans)


Measured memory_bytes: 3316
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.*;
public class Main{
	static int n;
	static int k;
	static int[] arr;
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.valueOf(br.readLine());
		long[] arr=new long[n];
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[i]=Long.valueOf(cmd[i]);
		}
		Arrays.sort(arr);
		long ans=arr[n-1];
		int k=n-2;
		for(int i=n-2;i>=0;i--)
		{
			if(k==0)
				break;
			if(k>=2)
			{
				k=k-2;
				ans=ans+2*arr[i];
			}
			else
			{
				k--;
				ans=ans+arr[i];
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 68796
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()

int main() 
{
	 // #ifndef ONLINE_JUDGE
  //       freopen("input.txt", "r", stdin);
  //       freopen("output.txt", "w", stdout);
  //   #endif
  //   fastio();
    ll n,k;
    cin>>n>>k;
    vector<ll> v(n);
    loop(i,0,n)
    	cin>>v[i];
    vector<ll> dp(n+1,INT_MAX);
    dp[1] = dp[0] = 0;
    // dp[2] = abs(v[1] - v[0]);
    loop(i,2,n+1)
    {
    	loop(j,1,k+1)
    	{
    		int m = i-j>=1?i-j:1;
    		dp[i] = min(dp[i],dp[m] + abs(v[i-1] - v[m-1])); 
    	}
    }
    cout<<dp[n];
    
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define all(vv) (vv).begin(), (vv).end()
#define rep(ii, jj, ll, ss) for(int ii = jj; ii < ll; ii += ss)
#define time cerr << '\n' << (double)clock()/CLOCKS_PER_SEC << '\n';

string s;
int q, rev;
deque <char> d;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    rev = 0;
    cin >> s;
    rep(i, 0, (int)s.length(), 1) {
        d.pb(s[i]);
    }
    cin >> q;
    rep(i, 0, q, 1) {
        int t; cin >> t;
        if (t == 1) rev = 1 - rev;
        else {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (rev) d.pb(c);
                else d.pf(c);
            }
            else {
                if (rev) d.pf(c);
                else d.pb(c);
            }
        }
    }
    if (rev) {
        reverse(all(d));
        for(auto it:d) {
            cout << it;
        }
    }
    else {
        for(auto it:d) {
            cout << it;
        }
    }
    time;
}

Measured memory_bytes: 4120
import java.util.*;
import java.io.*;

public class Main {
    static IO io = new IO();
    public static void main(String[] args) {

        int s = io.nextInt();
        int h = s/3600;
        s %= 3600;
        int m = s/60;
        s %= 60;
        System.out.println(h + ":" + m + ":" + s);

    }

    static class IO extends PrintWriter {
        private final InputStream in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        IO() {
            this(System.in);
        }

        IO(InputStream source) {
            super(System.out);
            this.in = source;
        }

        boolean hasNextByte() {
            if (ptr < buflen) return true;
            else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) return false;
            }
            return true;
        }

        int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        void skipUnprintable() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        }

        boolean hasNext() {
            skipUnprintable();
            return hasNextByte();
        }

        long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }

        int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }
    }
}

Measured memory_bytes: 24380
#include <bits/stdc++.h>
using namespace std;
string N;
int main() {
	cin>>N;
	int sum=0;
	for(int i=0;i<N.length();i++) {
		sum+=N[i]-'0';
	}
	if(sum%9==0) {
		cout<<"Yes";
	} else {
		cout<<"No";
	}
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char sp = ' ';

int N;
ll K, A[200000], L, R;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	L = -2e18;
	R = 2e18;
	while (L + 1 != R) {
		ll M = (L + R) / 2;
		ll cnt = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] < 0) {
				int l, r;
				l = i;
				r = N;
				while (l + 1 != r) {
					int m = (l + r) / 2;
					if (A[i] * A[m] <= M) {
						r = m;
					}
					else {
						l = m;
					}
				}
				cnt += N - r;
			}
			else {
				int l, r;
				l = i;
				r = N;
				while (l + 1 != r) {
					int m = (l + r) / 2;
					if (A[i] * A[m] <= M) {
						l = m;
					}
					else {
						r = m;
					}
				}
				cnt += l - i;
			}
		}
		if (cnt < K)L = M;
		else R = M;
	}
	cout << R << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;

int main(int argc, char** argv){
	int a;
	string s;
	cin >> a;
	cin >> s;
	if(a >= 3200){
		cout << s << endl;
	}else{
		cout << "red" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
/*  ex 7_1
    shu_t */

#include <stdio.h>

//def point: coodinates
typedef struct point{
    int x_elem;
    int y_elem;
}point;

//vertex movement
point shift_point(point vertex, int x, int y){
    point new_vertex;//after movement
    new_vertex.x_elem = vertex.x_elem + x;//add second argument
    new_vertex.y_elem = vertex.y_elem + y;//add third argument
    return new_vertex;
}

int main(void){
    point vertex1,vertex2,vertex3,vertex4;//vertexi: No.i coodinates
    int dif_x,dif_y;//difference vertex1 and vertex2
    //input vertex1 and vertex2
    scanf("%d %d %d %d",&vertex1.x_elem,&vertex1.y_elem,&vertex2.x_elem,&vertex2.y_elem);
    //calculate difference
    dif_x = vertex1.x_elem - vertex2.x_elem;
    dif_y = vertex1.y_elem - vertex2.y_elem;
    //decide vertex3 and vertex4
    vertex3 = shift_point(vertex2, dif_y, -dif_x);
    vertex4 = shift_point(vertex1, dif_y, -dif_x);
    //output answer
    printf("%d %d %d %d",vertex3.x_elem,vertex3.y_elem,vertex4.x_elem,vertex4.y_elem);
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
string n,m,k,x,y,z,s,t,c,d,i,j,l,r,f;








void sol()
{   int a,b;
    cin>>s>>t>>a>>b>>x;
    
    if(x==s)a--;
    else b--;
    
    
    cout<< a<<" "<<b <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

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

typedef long long ll;

using namespace std;

int main() {
    ll N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        int tmp = 0;
        for (int j = 1; j <= i; ++j) {
            if (i % j == 0) tmp++;
        }
        if (tmp == 8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);



int main()
{
    fastInp;
    
    char ch;
    cin >> ch;

    if (ch >= 'A' && ch <= 'Z') {
        cout << 'A';
    }
    else {
        cout << 'a';
    }

    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n,a[110];

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

    int i,j;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    int ans=0;
    for(i=1;i<n-1;i++)
        if( (a[i]>a[i-1]&&a[i+1]>a[i]) || (a[i]<a[i-1]&&a[i+1]<a[i]))
            ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long long ll;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 2000000009
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  int n,k;cin>>n>>k;vint d(k);
  for(int i=0;i<k;i++){cin>>d[i];}
  //caricurate
  for(long long j=n;j<100000;j++){
    bool g=true;
    for(int y=0;y<k;y++){
      if(j>9999){
      if(((j%10000)/1000)==d[y]){g=false;break;}
      if(((j%1000)/100)==d[y]){g=false;break;}
      if(((j%100)/10)==d[y]){g=false;break;}
      if((j%10)==d[y]){g=false;break;}
      if((j/10000)==d[y]){g=false;break;}
      }
      else if(j>999){
      if(((j%1000)/100)==d[y]){g=false;break;}
      if(((j%100)/10)==d[y]){g=false;break;}
      if((j%10)==d[y]){g=false;break;}
      if((j/1000)==d[y]){g=false;break;}
     }
     else if(j>99){
      if(((j%100)/10)==d[y]){g=false;break;}
      if((j%10)==d[y]){g=false;break;}
      if((j/100)==d[y]){g=false;break;}
     }else if(j>9){
      if((j%10)==d[y]){g=false;break;}
      if((j/10)==d[y]){g=false;break;}
     }else{
       if(j==d[y]){g=false;break;}
     }
    }
    if(g){cout<<j<<endl;return 0;}
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
#include <map>
#define N int(1e5+10)
#include <queue>
using namespace std;

vector<int> e[N];
int dp[N];
map<int,int> ind;

int main(int argc,char ** argv)
{
    int n,m,a,b;
    cin>>n>>m;
    for(int i=0;i<m;++i){
        cin>>a>>b;
        e[a].push_back(b);
        ++ind[b];
    }
    queue<int>q;
    for(int i=1;i<=n;++i)if(ind[i]==0)q.push(i);
    while(!q.empty()){
        int cur=q.front();
        q.pop();
        for(auto iter:e[cur]){
            if(--ind[iter]==0){
                q.push(iter);
            }
            dp[iter]=max(dp[iter],dp[cur]+1);
        }

    }
    int ans=0;
    for(int i=1;i<=n;++i)ans=max(ans,dp[i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 13964
/*
  "I knew I shouldn't have
   gotten out of bed today."
   - Squidward Tentacles
*/
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstring>
#include<climits>
#include<numeric>

#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>

#include<fstream>
#include<chrono>
using namespace std;
// using namespace __gnu_pbds;

#define int          long long
#define ld           long double
#define pii          pair<int,int>
#define vi           vector<int>
#define maxheap      priority_queue<int>
#define minheap      priority_queue<int,vi,greater<int>>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define brep(i,s,e)  for(int i=s;i>=e;i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,y,sizeof(x))
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define VR46         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int MOD = 1e9+7;
ld EPS = 1e-12;

vi adj[(int)1e5+5];
bool vis[(int)1e5+5];
int d1[(int)1e5+5];
int d2[(int)1e5+5];

bool done = false;

void DFS(int v, int dep)
{
    if( vis[v] ) return;
    // cout<<v<<" "<<dep<<endl;
    vis[v] = true;
    if( !done ) d1[v] = dep;
    else d2[v] = dep;
    for(auto i:adj[v]) DFS(i,dep+1);
}

signed main()
{
    VR46 ofstream out("output.txt");
    // auto start = chrono::high_resolution_clock::now();

    // GANDU TEST CASE BNAKE TEST KRLE
    // OUT OF BOUNDS BHI DEKHLIO CHUTIYE
    int t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        int n, u, v, x, y;
        cin>>n>>u>>v;
        rep(i,1,n-1) cin>>x>>y, adj[x].pb(y), adj[y].pb(x);
        mem( vis,false ), mem( d1,0 ), mem( d2,0 );
        DFS( u,0 ), done = true;
        mem( vis,false ), DFS( v,0 );
        int ans = 0;
        // rep(i,1,n) cout<<d1[i]<<" "<<d2[i]<<endl;
        rep(i,1,n) if( d1[i]<d2[i] ) ans = max( ans,d2[i]-1 );
        bool same = false;
        int sm = LLONG_MAX;
        rep(i,1,n) if( d1[i]==d2[i] ) sm = true, sm = min( sm,d1[i] );
        if( same ) ans = max( ans,sm );
        cout<<ans<<endl;
    }

    // auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout<<"Time taken by function: "<<duration.count()<<" milliseconds"<<endl;

    // *( hsh.find_by_order(k) ) kth smallest, from 0
    // hsh.order_of_key(k) num of ele str less than k
    // change less to less_equal for multiset pbds
}

Measured memory_bytes: 10112
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner scan = new Scanner(System.in);
		// ????????????????????????
		String str = scan.next();
		// ???????????°
		int q = scan.nextInt();
		// ???????????°?????????????????????
		for(int i = 0; i<q; i++){
			// ?????????????????????
			String m = scan.next();
			
			//print
			if(m.equals("print")){
				// a???b??????????????§???????????????
				int a = scan.nextInt();
				int b = scan.nextInt();
				String print = str.substring(a, b+1);
				System.out.println(print);
			}
			// reverse
			if(m.equals("reverse")){
				// a???b??????????????§???????????????
				int a = scan.nextInt();
				int b = scan.nextInt();
				String str2 = str.substring(a, b+1);
				// ?????????????????¢?????????
		        StringBuffer A = new StringBuffer();
		        for (int i2 = str2.length() - 1; i2 >= 0; i2--)
		            A.append(str2.charAt(i2));
		        //return dest.toString();
				String s1 = str.substring(0, a);
				String s3 = str.substring(b+1);
				str = s1 + A + s3;
			}
			// replace
			if(m.equals("replace")){
				// a???b??????????????§????????????
				int a = scan.nextInt();
				int b = scan.nextInt();
				// ????????????
				String p = scan.next();
				String s1 = str.substring(0, a);
				String s2 = p;
				String s3 = str.substring(b+1);
				str = s1 + s2 + s3;
			}
			
			
		}
		
	}

}

Measured memory_bytes: 30080
#include <iostream>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int main () {
  unsigned long long int input;
  unsigned long long int sum = 0;
  cin>>input;
  if (input == 1ull) {
    cout<<input<<endl;
  } else {
  	for (unsigned long long int i=1ull; i<=input; i++) {
  	  if (i % 3ull != 0ull && i % 5ull != 0ull) {
        sum += i;
      }
    }
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 3540
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] height = new int[n];
    for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    }

    boolean pos = true;
    for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    }
    if(pos){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}




Measured memory_bytes: 48740
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//l={1,2,3,4}
//sort(l,l+N,greater<int>());	降順ソート
//sort(l,l+N);	昇順ソート
//string 変数　　変数.size()で数字化


int main(void)
{
	int h, w;
	cin >> h >> w;
	char test[105][105];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> test[i][j];
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << test[i][j];
		}
		cout << endl;
		for (int j = 0; j < w; j++) {
			cout << test[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>









const int N = 2010;
ll n, dp[N][N];
ii p[N];




void solve()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> p[i].st;
		p[i].nd = i;
	}
	sort(p + 1, p + n + 1);
	reverse(p + 1, p + n + 1);
	for(int j = 0; j < n + 1; j++)
	{
		dp[n + 1][j] = 0;
	}
	for(int i = n; i >= 1; i--)
	{
		for(int j = 0; j < i; j++)
		{
			dp[i][j] = max(dp[i + 1][j + 1] + p[i].st*(p[i].nd - j - 1), dp[i + 1][j] + p[i].st*(n - i + j + 1 - p[i].nd));
		}
	}
	cout << dp[1][0] << "\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> w(n);
    int hanbun = 0;
    cin >> w[0];
    FOR(i, 1, n - 1)
    {
        int _w;
        cin >> _w;
        w[i] += w[i - 1] + _w;
    }

    hanbun /= 2;
    ll sa = INF;
    ll tmp = 0;
    REP(i, n - 1)
    {
        int left = w[i], right = w[n - 1] - w[i];
        if (sa > abs(right - left))
            sa = abs(right - left);
    }
    cout << sa << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
n,m,t=map(int,input().split())
a=list(map(int,input().split()))
d=[0]
for time in a:
    f=False
    if d[-1]<time-m:
        d.append(max(time-m,0))
    else:
        f=True
    if f:
        d[-1]=max(d[-1],time+m)
    else:
        d.append(min(time+m,t))
del d[0]
data=[False for i in range(t)]
i=0
while i<len(d)-1:
    data[d[i]:d[i+1]]=[True for j in range(len(data[d[i]:d[i+1]]))]
    i+=2
print(data.count(False))


Measured memory_bytes: 5812
#include<stdio.h>

int main(){

  int n, k;
  int r, s, p;
  scanf("%d %d", &n, &k);
  scanf("%d %d %d", &r, &s, &p);
    char t[n];
  scanf("%s",t);

  //printf("n: %d, k: %d, r: %d, s: %d, p: %d, \nt:%s\n",n,k,r,s,p,t);

  int i = 0;
  //printf("%c\n", t[5]);

  for(i = k; i<n; i++){
    if (t[i] == t[i-k]){
      t[i] = 'a';
    }
  }
  //printf("\n%s\n", t);
  int sub = 0;
  for (i = 0; i< n;i++){
    if (t[i] == 'r'){
      sub+=p;
    }else if (t[i] == 's'){
        sub+=r;
      }else if (t[i] == 'p'){
          sub+=s;
        }
        //printf("途中sub:%d,文字列%s\n",sub,t);
    }
  printf("%d\n",sub);
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

q,h,s,d=map(int,input().split())
n=int(input())
s=min(q*4,h*2,s)
if s*2<d:
    print(s*n)
else:
    if n%2:
        print(d*(n//2)+s)
    else:
        print(d*(n//2))

Measured memory_bytes: 61740
/*---Bismillahir Rahmanir Rahim---*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std; 

map <char,int> cnt;
inline void solve()
{
	string s; int l=0,r=0;
	cin >> s; 
	for (int i=0;i<sz(s);i++) {
		if (i&1){
			if (s[i] == '0') l++; //000
		}
		else {
			if (s[i]=='1') l++;
		}
	}
	for (int i=0;i<sz(s);i++) {
		if (i&1){
			if (s[i] == '1') r++;
		}
		else {
			if (s[i]=='0') r++;
		}
	}
	
	cout << min(l,r) << endl;
}

signed main()
{
	int t=1; // cin>>t;
	while(t--) solve();
	return 0;
}

/*
3 4
2 1 3
3 1 2 3
2 3 2

*/


Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x1, x2, x3, x4, x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    int flag = 0;
    if(x1 == 0) flag = 1;
    if(x2 == 0) flag = 2;
    if(x3 == 0) flag = 3;
    if(x4 == 0) flag = 4;
    if(x5 == 0) flag = 5;
    cout << flag << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        sc.close();

        int abs = (int)Math.abs(n - m);
        long count = 1;
        if (abs > 1) {
            System.out.println("0");
            System.exit(0);
        } else {
            while (n != 1) {
                count = count * n % (long)(Math.pow(10, 9) + 7);
                n--;
            }
            while (m != 1) {
                count = count * m % (long)(Math.pow(10, 9) + 7);
                m--;
            }
        }

        if (abs == 0) System.out.println((int)count * 2 % (long)(Math.pow(10, 9) + 7));
        else System.out.println((int)count);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll v[100100],rs[100100],alt[100100];
int n,q;
inline ll sm(int a, int b) {
	return rs[b+1]-rs[a];
}
inline ll gid(int val, int id) {
	return id-(lower_bound(v,v+n,val-abs(val-v[id]))-v);
}
ll pr(int val) {
	int id = lower_bound(v,v+n,val)-v;
	if(id > 0 && abs(v[id-1]-val) <= abs(v[id]-val)) {id--;}
	int vl = upper_bound(v,v+n,2*val-v[0])-v-1;
	int il = gid(val,n/2);
	if(il == n/2) {return sm(n/2,n-1);}
	int s = id,e = n-1;
	int ls=e;
	while(s <= e) {
		//printf("se %d %d\n",s,e);
		int md = (s+e)/2;
		int g = gid(val,md);
		//printf("g %d %d %d\n",val,md,g);
		if(g >= n-md-1) {e = md-1;ls = min(ls,md);} else {
			s = md+1;
		}
	}
	int ns = ls-(n-ls)-1;
	//printf("li %d %d\n",ls,ns);
	return sm(ls,n-1) + alt[ns+2];
}
int main() {
	scanf("%d %d ",&n,&q);
	rs[0] = alt[0] = 0;
	alt[1] = 0;
	for(int i=0;i<n;i++) {
		ll t;
		scanf("%lld ",&t);
		v[i] = t;
		rs[i+1] = rs[i]+t;
		alt[i+2] = alt[i]+t;
	}
	while(q--) {
		int t;
		scanf("%d ",&t);
	printf("%lld\n",pr(t));
	}
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
 
#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
 
 
using namespace std;
 
void swap(int *a,int *b){
	int tmp = *a;
	*a = *b;
	*b = tmp;
}
 
void babbleSort(int *a,int *b,int num){
 
	for(int i=0;i<num;i++){
		for(int j=num-1;j>i;j--){
			if(a[j]<=a[j-1]){
				swap(&a[j],&a[j-1]);
				swap(&b[j],&b[j-1]);
			}
		}
	}
 
}
 
int main(){
 
	int n;
	
	cin>>n;
	int *a,*b,*c,*d;
	a = new int[n];
	b = new int[n];
	c = new int[n];
	d = new int[n];
 
	int *flag;
	flag = new int[n];
 
	REP(i,n)cin>>a[i]>>b[i];
	REP(i,n)cin>>c[i]>>d[i];
	REP(i,n)flag[i]=0;
 
	babbleSort(a,b,n);
	babbleSort(c,d,n);
 
	lli ans=0;
 
	REP(i,n){
		int maxY=-10000;
		int point=-1;
		REP(j,n){
			if( (a[j]<c[i]) && (b[j]<d[i])){
				if(flag[j]==0){
					if(maxY<=b[j]){
						maxY = b[j];
						point = j;
					}
				}
			}
		}
		if(point>=0){
			ans++;
			flag[point]=1;
		}
	}
 
	cout<<ans<<endl;
 
 
	return 0;
 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] up = new int[n];
		int[] max = new int[n];
		int MAX = 0;
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			s[i] = scan.next();
		}
		int m = scan.nextInt();
		int[] down = new int[n];
		String t[] = new String[m];
		for (int i = 0; i < m; i++) {
			t[i] = scan.next();
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (s[i].equals(s[j])) {
					up[i]++;
				}
			}
		}
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					if (s[i].equals(t[j] )) {
						down[i]++;
					}
				}
			}
			for (int i = 0; i < n; i++) {
				max[i] = up[i] - down[i];
				if (max[i] > MAX) {
					MAX = max[i];
				}
		}
		if (MAX > 0) {
			System.out.println(MAX);
		} else {
			System.out.println(0);
		}
	}
}


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

int N;
std::map<string, int> m{{"AC", 0}, {"WA", 0}, {"TLE", 0}, {"RE", 0}};
void input() {
  cin >> N;
  string s;
  rep(i, 0, N) {
    cin >> s;
    m[s]++;
  }
}
void solve() {
  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;
}

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

Measured memory_bytes: 3664
var=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
x=int(input())
xx=x-1
print(var[xx])

Measured memory_bytes: 3060
from heapq import heappush, heappop, heapify
from bisect import bisect_right

pow2 = [2]
for i in range(29):
  pow2.append(pow2[-1]*2)

N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1

A = [-a for a in A]
heapify(A)
ans = 0
while A:
  a = - heappop(A)
  if d[a] == 0:
    continue
  pair = pow2[bisect_right(pow2, a)] - a
  if a == pair:
    if d[a] >= 2:
      d[a] -= 2
      ans += 1
  elif pair in d and d[pair] > 0:
    ans += 1
    d[pair] -= 1
    d[a] -= 1

print(ans)

Measured memory_bytes: 122956
package main

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

func main() {
	parseProblem(os.Stdin)
}

func parseProblem(r io.Reader) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines

	n := scanInt(sc)
	for i := 0; i < n; i++ {
		v := scanInt(sc)
		if v%2 == 1 {
			continue
		}
		if !(v%3 == 0 || v%5 == 0) {
			fmt.Println("DENIED")
			return
		}
	}
	fmt.Println("APPROVED")
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 640
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL << 30)
#define LLINF (1LL << 60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

struct edge{ll to, cost;};
struct edge1{ll from, to, cost;};
//グラフの隣接リスト
vector<edge> g[100010];
edge1 gg[100010];
//頂点の入次数を管理
int h[100010], d[100010], a[100010];
bool flag[100010];

signed main(void) {
	int n, m;
	cin >> n >> m;
	REP(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		g[a-1].PB({b-1, c});
		gg[i] = {a-1, b-1, c};
		h[b-1]++;
	}
	//cout << LLINF << endl;
	/*stack<int> st;
	REP(i, n) if(h[i] == 0) st.push(i);

	VI ans;
	while(st.size()) {
		int i = st.top(); st.pop();
		ans.PB(i);
		//cout << i << endl;
		for(auto& j: g[i]) {
			h[j.to]--;
			if(h[j.to] == 0) st.push(j.to);
		}
	}
	if(ans.size() != n) {cout << "inf" << endl; return 0;}*/

	//memset(d, 0, sizeof(d));
	fill(d, d+n, -LLINF);
	d[0] = 0;
	REP(i, 2*n) REP(j, m) {
		edge1 e = gg[j];
		if(d[e.to] < d[e.from] + e.cost) {
			d[e.to] = d[e.from] + e.cost;

			//if(i >= n-1) flag = true;
			if(e.to == n-1) flag[i] = true;
		}
	}
	if(flag[2*n-1]) cout << "inf" << endl;
	else cout << d[n-1] << endl;
	return 0;

	priority_queue<pair<ll, ll>> que;
	fill(d, d+n, -LLINF);
	d[0] = 0;
	que.push({0, 0});

	while(que.size()) {
		pair<ll, ll> p = que.top(); que.pop();
		if(d[p.second] > p.first) continue;
		for(edge i: g[p.second]) {
			if(d[i.to] < d[p.second] + i.cost) {
				d[i.to] = d[p.second] + i.cost;
				que.push({d[i.to], i.to});
			}
		}
	}
	cout << d[n-1] << endl;
  return 0;
}


Measured memory_bytes: 5504
line = input().split(" ")
k = int(line[0])
s = int(line[1])
count = 0

for x in range(0, k+1, 1):
    for y in range(0, k+1, 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1

print(count)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    static long gcd(long ai, long aj) {
        if (aj == 0)
            return ai;
        else
            return gcd(aj, ai % aj);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long A = sc.nextLong();
        long B = sc.nextLong();
        long gcd = gcd(A, B);
        int count = 1;

        for (int i = 2; i <= Math.sqrt(gcd); i++) {
            if (gcd % i == 0) {
                count++;
            }
            while (gcd % i == 0) {
                gcd /= i;
            }
        }

        if(gcd >1)
            count++;

        System.out.println(count);

    }
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n, a = 0, b = 0, c = 0;
    string s;
    cin >> n >> s; 
    rep(i, s.size()){
        if(s[i] == '(')a++;
        else {
            b++;
            if(a < b){c++; b--;}
        }
    }
    rep(i, c)cout << "(";
    cout << s;
    rep(i, a-b)cout << ')';
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (i==n-1?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, x[100], y[100];

signed main() {
	cin >> n;
	rep(i,n) cin >> x[i] >> y[i];
	rep(i,n) {
		vector<double> ang;
		rep(j,n) if (i!=j) ang.pb(atan2(y[j]-y[i], x[j]-x[i]));
		sort(all(ang));
		double mx = 0;
		rep(j,n-2) chmax(mx, ang[j+1]-ang[j]);
		chmax(mx, ang[0]+2*M_PI-ang[n-2]);
		double res = (mx>M_PI ? (mx-M_PI)/(2*M_PI) : 0);
		printf("%.14lf\n", res);
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
#define deb(x) cout <<"\n"<< (#x) << " = " << (x) << "\n"
const long long  INF = 1e18;
const long long mod=1e9+7 ;
void inputoutput()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); 
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	    
}


vector<int> adj[100500];
vector<bool> vis(100500);
vector<int> d(100500);
queue<int> q ;



void bfs(int v)
{
	q.push(v);
	vis[v]=true;
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(auto u : adj[x])
		{
			if(!vis[u])
			{
				vis[u]=true;
				q.push(u);
				d[u] = d[v] + 1;
			}
		}
	}
}
void dfs(int v)
{
	vis[v]=true;
	for(auto u : adj[v])
	{
		if(!vis[u])
			dfs(u);
	}
}

void solve()
{
	long long int n;
	cin>>n;

	long long int sum=0 ;

	for(long long int i=1 ; i<n ; ++i)
	{
		sum+=(n+i-1)/(i)-1;
	}
	cout<<sum;
}

int32_t main()
{ 
	inputoutput() ;
	solve();


	return 0;
}


Measured memory_bytes: 6040
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			List<Integer> carNumbers = new ArrayList<Integer>();
			while (sc.hasNextInt()) {
				int carNumber =sc.nextInt();
				if(carNumber!=0){
					carNumbers.add(carNumber);
				}else{
					System.out.println(carNumbers.get(carNumbers.size()-1));
					carNumbers.remove(carNumbers.size()-1);
				}
			}
		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 17220
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))

Measured memory_bytes: 14180
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {is >> v[i];	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	int ans=0;
	cin >>s;
	rep(i,4){
		if(s[i]=='+'){
			ans++;
		}else{
			ans--;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        var a = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();

        if(a >= 3200)
        {
            Console.WriteLine(s);
        }
        else
        {
            Console.WriteLine("red");
        }
    }
}


Measured memory_bytes: 11092
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:usize,
    mut b:[(String,isize);a],
    }
    let mut b = b.iter().enumerate().collect_vec();
    b.sort_by(|a, b| (a.1).0.cmp(&(b.1).0).then((b.1).1.cmp(&(a.1).1)));
    for i in 0..a {
        println!("{}", b[i].0+1);
    }
}

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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

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

    ll n;
    cin >> n;
    auto v = multimap<string, ll>();

    REP(i, n) {
        int    q;
        string k;
        cin >> q >> k;
        if (q == 0) {
            int x;
            cin >> x;
            v.emplace(k, x);
        } else if (q == 1) {
            auto p = v.equal_range(k);
            for (auto it = p.first; it != p.second; ++it){
                cout << it->second << endl;
            }
        } else if (q == 2) {
            v.erase(k);
        } else if (q == 3) {
            string L = k, R;
            cin >> R;
            for (auto it = v.lower_bound(L); it != v.end() && it->first <= R; ++it) {
                cout << it->first << " " << it->second << endl;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 24888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        var weather = Console.ReadLine();
        var nextWeather = "";

        switch (weather)
        {
            case "Sunny":
                nextWeather = "Cloudy";
                break;
            case "Cloudy":
                nextWeather = "Rainy";
                break;
            case "Rainy":
                nextWeather = "Sunny";
                break;

            default:
                break;
        }

        Console.WriteLine(nextWeather);
    }
}


Measured memory_bytes: 11092