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

typedef long long ll;

struct doll{
    int first, second;
    doll(int first, int second) : first(first), second(second) { }
};
bool operator < (const doll &a, const doll &b){
    return a.first*2+a.second==b.first*2+b.second ? (a.first==b.first ? a.second < b.second : a.first < b.first) : a.first*2+a.second < b.first*2+b.second;
}

int main(){
    while(true){
        int n, m;
        cin >> n;
        if(n==0) break;
        vector<doll> v;
        for(int i=0; i<n; i++){
            int h, r;
            cin >> h>> r;
            v.push_back(doll(h, r));
        }
        cin >> m;
        for(int i=n; i<n+m; i++){
            int h, r;
            cin >> h>>r;
            v.push_back(doll(h, r));
        }
        sort(v.begin(), v.end());
        ll dp[1010];
        fill(dp, dp+1001, 1);
        
        ll ans=0;
        
        for(int i=0; i<n+m; i++){
            for(int j=0; j<i; j++){
                if(v[i].first-v[j].first>0 && v[i].second-v[j].second>0){
                    dp[i]=max(dp[j]+1, dp[i]);
                }
            }
            //cout << "dp[" << v[i].first << ", " << v[i].second << "]=" << dp[i] << "\n";
            ans=max(ans, dp[i]);
        }
        
        cout << ans << "\n";
        
        
        
    }
    
    
    return 0;
}


Measured memory_bytes: 3080
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
#include <cstring>
using namespace std;

char input[1002][82];
map<int,int> areas;


void trapezoids(int y, int x){
	int a = 0, b = 0, c = 0;

	while( input[y][x] == '*' ){
		input[y][x] = '_';
		++x;
		++a;
	}
	--x;

	int d;
	for(d = 1; d >= -1; --d){
		if( input[y+1][x+d] == '*' ) break;
	}

	do{
		input[y][x] = '_';
		++y;
		x += d;
		++b;
	} while( input[y][x] == '*' );
	--y;
	x -= d;

	do{
		input[y][x] = '_';
		--x;
		++c;
	} while( input[y][x] == '*' );
	++x;

	for(bool found = true; found; ){
		found = false;
		
		for(int i = -1; i <= 1; ++i){
			if( input[y-1][x+i] == '*' ){
				--y;
				x += i;
				input[y][x] = '_';
				found = true;
				break;
			}
		}
	}
	
	++areas[(a + c) * b / 2];
}

int main(){
	int h;
	const char *sep = "";

	while( scanf("%d", &h), h != 0 ){
		printf(sep);
		areas.clear();
		memset(*input, 0, sizeof(input) );
		
		for(int i = 1; i <= h; ++i){
			scanf("%*c%[^\n]", input[i] + 1);
		}
		
		for(int i = 1; i <= h; ++i)
		for(int j = 1; j <= 80; ++j){
			if( input[i][j] == '*' ){
				trapezoids(i, j);
			}
		}
		
		map<int,int>::iterator it;
		for(it = areas.begin(); it != areas.end(); ++it){
			printf("%d %d\n", it->first, it->second);
		}
		
		sep = "----------\n";
	}
}

Measured memory_bytes: 1128
import java.util.Scanner;

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

		double w = sc.nextDouble();
		double h = sc.nextDouble();
		double x = sc.nextDouble();
		double y = sc.nextDouble();

		double res = w * h / 2;

		System.out.println(res);

		if (w / x == 2 && h / y == 2) {
			System.out.println(1);
		} else {
			System.out.println(0);
		}

	}
}

Measured memory_bytes: 24532
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        StringBuilder sb = new StringBuilder();
        sb.append(t);
        sb.append(s);
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21844
import math
n = int(input())
 
if n%2 == 1:
  print(0)
else:
  out = 0
  n //= 2
  x = math.log((10**18)//2, 5)
  for i in range(math.floor(x)):
    out += n // 5**(i+1)
 
  print(out)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0) {
    return b;
  }else {
    return (gcd(b,(a%b)));
  }
}
signed main() {
  int n;
  cin >> n;
  cout <<  360 / gcd(n, 360) << "\n";
  return 0;
}


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1000000007;
const int INF = 1<<18;
const lint INFLINT = 1LL << 60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

lint n, k, x, y;
string s;

int main() {
    cin >> n >> k;
    
    lint ans = min(n % k, abs(n % k - k));
    cout << ans;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k,s;cin >> k >> s;
	int ans = 0;
	rep(i,k + 1){
		rep(j,k + 1){
			if(i + j <= s && s - i - j <= k) ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  char a,b;cin>>a>>b;
  string A,B;
  rep(i,a-'0') B+=b;rep(i,b-'0') A+=a;
  set<string> st;st.insert(A);st.insert(B);
  for(string s:st) {print(s);break;}
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void run (void) {
  i32 n, w;
  scanf ("%" SCNi32 "%" SCNi32, &n, &w);
  i64 *dp = ALLOC (w + 1, i64);
  while (n--) {
    i32 a, b;
    scanf ("%" SCNi32 "%" SCNi32, &a, &b);
    for (i32 i = w; i >= a; --i) {
      i64 x = dp[i - a] + b;
      dp[i] = MAX (dp[i], x);
    }
  }
  printf ("%" PRIi64 "\n", dp[w]);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const ll MOD = 1e9 + 7;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

ll comb(ll n, ll r) {
    ll ret = 1;
    for (ll i = 0; i < r; i++) ret = ret * (n - i);
    for (ll i = 1; i <= r; i++) ret /= i;
    return ret;
}

int main(){
    ll n,l,r; cin >> n;
    vector<vector<ll>> c(9,vector<ll>(9,0));
    ll ans = 0;

    for(int i = 1; i <= n; i ++){
        r = i%10;
        l = i;
        while(l/10 != 0){
            l /= 10;
        }
        if(l != 0 && r != 0)c[l-1][r-1] ++;
    }

    rep(i,9){
        rep(j,9) ans += c[i][j]*c[j][i];
    }

    cout << ans;

}

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

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n << endl;
  } else {
    cout << n * 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	set<char> s;
	rep(i,0,n){
		char a; cin>>a;
		s.insert(a);
	}
	if(s.size()==3) cout<<"Three";
	else cout<<"Four";
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

const int LAST = 11;

int value[(1 << 18) + 7], weight[(1 << 18) + 7];
vector <pair <int, int> > spis[(1 << 18) + 7];
int deep[(1 << 18) + 7];

int main()
{
 	//freopen("input.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
 	ios_base::sync_with_stdio(0); cin.tie(0);
 	int n, quer;
 	cin >> n;
 	for (int i = 1; i <= n; i++) cin >> value[i] >> weight[i];
 	
 	for (int i = 2; i <= n; i++) deep[i] = deep[i / 2] + 1;
 	
 	spis[0].pb(mp(0, 0));
 	for (int i = 1; i <= n; i++)
 	{
 		if (deep[i] == LAST + 1) {spis[i].pb(mp(0, 0)), spis[i].pb(mp(weight[i], value[i])); continue;}
 		spis[i] = spis[i / 2];

 		vector <pair <int, int> > cop;
 		for (int j = 0; j < (int) spis[i].size(); j++)
 			cop.pb(mp(spis[i][j].x + weight[i], spis[i][j].y + value[i]));
 		vector <pair <int, int> > cops((int) cop.size() + (int) spis[i].size());
 		merge(spis[i].begin(), spis[i].end(), cop.begin(), cop.end(), cops.begin());
 		spis[i] = cops;
 	}
 	
 	cin >> quer;
 	for (int rep = 1; rep <= quer; rep++)
 	{
 	 	int vert, cap;
 	 	cin >> vert >> cap;
 	 	
 	 	if (deep[vert] <= LAST)
 	 	{
 	 	 	int ans = 0;
 	 	 	for (int i = 0; i < (int) spis[vert].size(); i++) if (spis[vert][i].x <= cap) ans = max(ans, spis[vert][i].y);
 	 	 	cout << ans << '\n';
 	 	 	continue;
 	 	}

 	 	int mid = 0, cop = vert;
 	 	while (cop > 0)
 	 	{
 	 	 	if (deep[cop] == LAST) mid = cop;
 	 	 	cop /= 2;
 	 	}
 	 	int uk = -1, tek = 0, ans = 0;
 	 	for (int i = (int) spis[vert].size() - 1; i >= 0; i--)
 	 	{
 	 	 	while (uk < (int) spis[mid].size() - 1 && spis[mid][uk + 1].x + spis[vert][i].x <= cap)
 	 	 	{
 	 	 	 	uk++;
 	 	 	 	tek = max(tek, spis[mid][uk].y);
 	 	 	}
 	 	 	if (uk != -1) ans = max(ans, spis[vert][i].y + tek);
 	 	}
 	 	cout << ans << '\n';
 	}
 	return 0;
}

Measured memory_bytes: 191668
from collections import defaultdict
import sys

next(sys.stdin)

count = defaultdict(int)
for a in next(sys.stdin).strip().split():
    count[int(a)] += 1

even = sum(1 for n in count.values() if n % 2 == 0)
if even % 2 == 0:
    print(len(count))
else:
    print(len(count) - 1)


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

#define REP(i,n) for(int i=0; i<n; i++)
#define MAXN 300005

using namespace std;

int main(){
	int n, min;
	vector<int> east;
	vector<int> west;
	string s;
	
	min = MAXN;
	
	cin >> n >> s;
	
	east.push_back(0);
	west.push_back(0);
	REP(i,n){
		east.push_back(s[i]=='E' ? 1 : 0);
		west.push_back(s[i]=='W' ? 1 : 0);
	}
	east.push_back(0);
	west.push_back(0);
	
	for (int i=1; i<=n+1; i++){
		west[i] += west[i-1];
		east[n+1-i] += east[n+2-i];
	}
	
	/*/
	REP(i,n+2){
		printf("%d ", east[i]);
	}
	cout << endl;
	REP(i,n+2){
		printf("%d ", west[i]);
	}
	cout << endl;
	/*/
	 
	for (int i=1; i<=n; i++){
		if (east[i]+west[i]<min) min = east[i]+west[i];
	}
	
	min--;
	
	cout << min << endl;
	
	return 0;
}


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

using namespace std;

int main() {
    int N = 0;
    cin >> N;

    int L = 0;
    cin >> L;
    vector<string> A(N);
    for(int i = 0; i < N; i++) {
    cin >> A.at(i);
    }
    sort(A.begin(),A.end());
    for (size_t i = 0; i < N; i++)
    {
        cout << A.at(i);
    }
    cout  << endl;
    
    

    return 0;
}

Measured memory_bytes: 3556
#include<stdio.h>

int main(void)
{
   char a[19];
   int i;

   for(i=0;i<19;i++)
      scanf("%c", &a[i]);

   for(i=0;i<19;i++)
      if(a[i] == ',')
         a[i] = ' ';

   for(i=0;i<19;i++)
      printf("%c", a[i]);

   printf("\n");
   return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int query(int x) {
	cout << x << endl;
	cout.flush();
	string s;
	cin >> s;
	if (s == "Vacant") return -1;
	if (s == "Male") return 0;
	return 1;
}

int main() {
	int N;
	cin >> N;
	
	int st = query(0);
	if (st == -1) return 0;
	
	int l = 0, r = N;
	while (r - l > 1) {
		int m = (l + r) / 2;
		
		int cur = query(m);
		if (cur == -1) return 0;
		
		if (((st + m) % 2) ^ cur) r = m;
		else l = m;
	}
	assert(false);
	return 0;
}


Measured memory_bytes: 852
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

int w, h;
vector<vector<int>> grid;

void dfs(int x, int y) {
  grid[x][y] = 0;
  rep(i, 8) {
    if(x+dx[i] >= 0 && x+dx[i] < h && y+dy[i] >= 0 && y+dy[i] < w) {
      if(grid[x+dx[i]][y+dy[i]]) {
        dfs(x+dx[i], y+dy[i]);
      }
    }
  }
}

int main() {
  while(cin >> w >> h && (w || h)) {
    grid = vector<vector<int>>(h, vector<int>(w));
    rep(i, h) rep(j, w)
      cin >> grid[i][j];
    int ans = 0;
    rep(i, h) rep(j, w) {
      if(grid[i][j]) {
        ans++;
        dfs(i, j);
      }
    }
    cout << ans << endl;
  }
  return 0;
}


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

int main(){
  int64_t H;
  int64_t W;
  cin >> H >> W;
  
  int64_t ans;
  
  if(H==1 || W==1){
    ans = 1;
  }
  else if(H%2==1 && W%2 ==1){
    ans = (H*W/2)+1;
  }
  else{
    ans = H*W/2;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

bool prime(ll n)
{
	if(n<=1)return false;
	if(n<=3)return true;
	if(n%2==0||n%3==0)return false;
	for(ll i=5;i*i<=n;i+=6)
	{
		if(n%i==0||n%(i+2)==0)return false;
	}
	return true;
}

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
		if(b&1)
		    r=(r*a)%m;
		b>>1;
		a=(a*a)%m;
	}
	return r%m;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	double l; cin>>l;
	long double x = l*l*l;
	x = x/27.0;
	cout<<fixed<<setprecision(10)<<x<<endl;
	return 0;
}


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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE
#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::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...);
}
#else
#define TR(...)
#endif
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;
int cnt[N];
bool prime[N];

void sieve() {
    for(int i = 2; i < N; ++i)
        prime[i] = 1;
    for(int i = 2; i < N; ++i) {
        if(prime[i])
            for(int j = 2*i; j < N; j += i) {
                prime[j] = 0;
            }
        
    }
}

int main() {
    int q;
    SI(q);
    sieve();
    for(int i = 1; i < N; ++i) {
        if((i&1) && prime[i] && prime[(i + 1)/2])
            cnt[i]++;
        cnt[i] += cnt[i-1];
    }
    while(q--) {
        int l, r;
        SI(l), SI(r);
        PI(cnt[r] - cnt[l-1]);
    }
    return 0;
}

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

int main(){
    int X;
    cin >> X;
    bitset<200000> dp;
    dp[0] = 1;
    for(int i=0; i<=X; i++) if(dp[i]) for(int j=100; j<=105; j++) dp[i+j] = 1;
    cout << dp[X] << endl;
    return 0;
}


Measured memory_bytes: 256
write_1 = input()
write_2 = input()

word = write_2
lis = []

judge = 0

for n in (write_2):
    lis.append(n)


for i in range(len(write_2)):
    a = lis.pop(0)
    lis.append(a)
    if write_1 == "".join(lis):
        judge += 1

print("Yes" if judge >= 1 else "No")

Measured memory_bytes: 3060
// Author: Sayantanu
#include <bits/stdc++.h>

using namespace std;

#define ll long long int
const int mod = 1e9 + 7;

struct day{
    int a;
    int b;
    int c;
};

int main() {
    //code
    int n;
    cin>>n;
    vector<day> arr(n);
    for(int i=0;i<n;i++)cin>>arr[i].a>>arr[i].b>>arr[i].c;
    int dp[3] = {0,0,0};
    for(int i=0;i<n;i++){
        int a = max(dp[1] + arr[i].a ,dp[2] + arr[i].a);
        int b = max(dp[0] + arr[i].b ,dp[2] + arr[i].b);
        int c = max(dp[0] + arr[i].c ,dp[1] + arr[i].c);
        dp[0]=a,dp[1]=b,dp[2]=c;
    }
    cout<<max({dp[0],dp[1],dp[2]});
    return 0;
}




Measured memory_bytes: 4576
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(std::string S){
  string n = {S[0]}; ll ans = S.length();
  for (int i = 1; i < S.length(); i++) {
    string x = {S[i]};
    if(n == x){
      n = {S[i],S[i+1]};
      i++;
      ans--;
    }else{
      n = S[i];
    }  
  }  
  cout << ans << endl;
}

int main(){
    std::string S;
	std::cin >> S;
    solve(S);
}


Measured memory_bytes: 772
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	vector<int> xy;
	for (int i = 1; i < 1111; ++i)
		for (int j = i; j < 1111; ++j)
			xy.push_back(i*i*i + j*j*j);
	sort(all(xy));

	int z;
	while (scanf("%d", &z), z)
		printf("%d\n", z*z*z - *(lower_bound(all(xy), z*z*z) - 1));
}

Measured memory_bytes: 3336
N = int( input())
A = list( map( int, input().split()))
B = list( map( int, input().split()))
cnt = sum(B) - sum(A)
cnta = 0
cntb = 0
for i in range(N):
    a = A[i]
    if A[i] == B[i]:
        pass
    elif A[i] > B[i]:
        cntb += A[i]-B[i]
    else:
        if (B[i]-A[i])%2 == 1:
            cnta += 1
            cntb += 1
        cnta += (B[i]-A[i])//2
if cnt <= -1:
    print('No')
elif cnt >= cnta and cnt >=  cntb and cnt - cntb == 2*(cnt - cnta):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 4536
/*siddharth goyal*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define MOD 1000000007
#define REP(i,n) for(i=1;i<=n;i++)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define vl vector<LL>
#define itr ::iterator it
#define lb lower_bound
#define ub upper_bound
#define LL long long
#define ULL unsigned long long
LL n,i,j,ans = 0,sz = 1e6+2;
int main()
{   // Read the constraints,highlights,Time Limit,Test Cases
    // Don't Panic
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL d,n ;
    cin>>d>>n ;
    if(d==0)
    {
        if(n<=99)
            cout<<n ;
        else cout<<"101" ;
        return 0 ;
    }
    if(d==1)
    { if(n==100)  cout<<10100<<endl ;
       else cout<<n*100 ;
        return 0 ;
    }
    if(d==2)
    {   if(n==100)  cout<<1010000 ;
        else cout<<n*100*100 ;
        return 0 ;
    }

}
// Check for 1,0, and other corner cases.


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


int main()
{
	int loop = 0;
	std::cin >> loop;
	std::vector<int> kagamiMochi(loop);

	for (int i = 0; i < kagamiMochi.size(); i++)
	{
		std::cin >> kagamiMochi.at(i);
	}

	std::sort(kagamiMochi.begin(), kagamiMochi.end());
	std::reverse(kagamiMochi.begin(), kagamiMochi.end());

	int count = 1;
	for (int i = 0; i < kagamiMochi.size(); i++)
	{
		if (i == kagamiMochi.size() - 1)
			continue;

		if (kagamiMochi.at(i) == kagamiMochi.at(i + 1))
			continue;

		count++;
	}

	std::cout << count << std::endl;
}

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

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    string s,t;
    map<string,int> mp;
    cin >> s >> t;
    cin >> mp[s] >> mp[t];
    string u;
    cin >> u;
    mp[u]--;

    cout << mp[s] << " " << mp[t] << endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;

string alphabet = "zabcdefghijklmnopqrstuvwxy";

void solve(){
  int n;
  cin >> n;
  int x = 0;
  vector<int> a(n);
  for(int i = 0;i < n;i++){
    cin >> a[i];
    x ^= a[i];
  }
  for(int i = 0; i<n;i++){
    cout << (x ^ a[i]) <<" ";
  }
  cout << endl;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}



Measured memory_bytes: 4732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
using namespace std;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define SINV(t) greater<t>()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP2(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

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

typedef long long ll;
#define vv(t) vector<t>

template<typename T>
void SV(vector<T> v){
    REP(i,v.size()){
        #ifdef LOCAL
            cout << i << " : " << v[i] << endl;
        #endif
    }
}

int bitCount(int bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >> 16);
}

int main(){
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    ll money = 0;
    if(X > Y){
        money = min(A*Y+B*Y, C*2*Y);
        X-=Y;
        money += min(A*X, C*2*X);
    }else{
        money = min(A*X+B*X, C*2*X);
        Y-=X;
        money += min(B*Y, C*2*Y);
    }
    cout << money << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<numeric>
#include<map>
 
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
typedef long long int ll;
#define ARRAY_MAX 200005
#define MOD 1000000007


int main(){

    ll n;
    cin >> n;
    vector<ll> a(ARRAY_MAX,0);
    REP(i,n){
        cin >> a[i+1];
    }
   
    REP(i,n+1){
        a[i+1] += a[i];
    }
    
    map<ll,ll> mp;
    REP(i,n+1){
        mp[a[i]]++;
    }
    ll ans = 0;
    for(auto itr:mp){
        //cout << itr.first << " " << itr.second << endl;
        ans += itr.second*(itr.second-1)/2;
        //cout << ans << endl;

    }
    cout << ans << endl;

   
    return 0;
}

Measured memory_bytes: 14336
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main(int argc, char const *argv[])
{
    int w,h,x,y;cin>>w>>h>>x>>y;
    cout << ll(w)*ll(h)/2.0l << " ";
    if(2*x==w && 2*y==h)cout << "1" << endl;
    else cout << "0" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000009
#define int long long 
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int pow(int p,int r){
	int ans=1;
	while(r>0){
     if(r&1){
		 ans=((ans%mod)*(p%mod))%mod;
	 }
	 r=r>>1;
     p=((p%mod)*(p%mod))%mod;
	}
	return ans;
}
signed main() {
    garou;
    int n,m,qe;
	cin>>n>>m>>qe;
	int a[qe][4];
	for(int i=0;i<qe;i++){
    cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];
	}
	int mx=-1;
	for(int i=1;i<=m;i++)
	for(int j=i;j<=m;j++)
	for(int k=j;k<=m;k++)
	for(int l=k;l<=m;l++)
	for(int o=l;o<=m;o++)
	for(int p=o;p<=m;p++)
	for(int z=p;z<=m;z++)
	for(int q=z;q<=m;q++)
	for(int u=q;u<=m;u++)
	for(int t=u;t<=m;t++){
		int arr[10]={i,j,k,l,o,p,z,q,u,t};
        int b=0;
		for(int x=0;x<qe;x++){
			if(arr[a[x][1]-1]-arr[a[x][0]-1]==a[x][2])
			b+=a[x][3];
		}
		mx=max(mx,b);
	}
	cout<<mx;
}

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

const int maxn = 100050;
const int P = 1e9+7;

int n, a[maxn], K;
int fac[maxn];
int c[maxn], pref[maxn], suf[maxn];

int exgcd(int a, int b, int &x, int &y)
{
	if(!b) {x = 1; y = 0; return a;}
	else {int t = exgcd(b, a%b, y, x); y -= x*(a/b); return t;}
}
int inv(int x)
{
	int a, y;
	exgcd(x, P, a, y);
	return (a+P)%P;
}
int C(int n, int m)
{
	m -= 2;
	n -= 2;
	if(!m) return 1;
	return ((fac[n] * 1ll * inv(fac[m]))%P)*inv(fac[n-m])%P;
}
int main()
{
	#ifdef MPS
		freopen("a.in","r",stdin);
		freopen("a.out","w",stdout);
	#endif
	scanf("%d%d",&n,&K);
	for(int i = 1; i <= n; ++ i) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	fac[0] = 1;
	for(int i = 1; i <= n; ++ i) fac[i] = (fac[i-1] * 1ll * i) % P;
	for(int i = 1; i <= n; ++ i) c[i] = C(i, K);
	for(int i = K; i <= n; ++ i) pref[i] = (pref[i-1] + c[i])%P;
	int x = n, sum = 0;
	for(int i = K; i <= n; ++ i) sum = (sum + c[i]) % P;
	for(int i = 1; i <= n-K+1; ++ i)
	{
		suf[i] = sum; sum -= c[x--]; sum = (sum + P) % P;
	}
	int ans = 0;
	for(int i = 1; i <= n; ++ i) ans = (ans + ((1ll * a[i] * pref[i]) % P))%P;
	for(int i = 1; i <= n; ++ i)
	{
		ans = (ans - ((1ll * a[i] * suf[i]) % P) + P) % P;
	}
	// for(int i = 1; i <= n; ++ i) cout << suf[i] << endl;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

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

        int X = sc.nextInt();

        System.out.println(solve(X));

        sc.close();
    }

    static int solve(int X) {
        int result = 1;
        for (int b = 2; b * b <= X; ++b) {
            int power = b * b;
            while (power * b <= X) {
                power *= b;
            }

            result = Math.max(result, power);
        }

        return result;
    }
}

Measured memory_bytes: 21844
import math
n = int(input())
x = []
y = []
sum = 0
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
for i in range(n):
    for j in  range(n):
        sum += math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
average  = (math.factorial(n)/n)*sum/(math.factorial(n))
print(average)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

long long int gcd (long long int n, long long int m)
{
    long long int maxn = max(n,m);
    long long int minn = min(n,m);
    if (maxn % minn == 0) {
        return minn;
    }
    return gcd(minn, maxn % minn);
}
int main(int argc, char const *argv[]) {
  ll N, M;
  std::cin >> N >> M;
  string S, T;
  std::cin >> S;
  std::cin >> T;
  ll lcm = (N * M)/gcd(N, M);
  int s=0, t=0;
  bool flag = 1;
  while(true){
    if(s>=N||t>=M) break;
    if(S[s] != T[t]) flag = false;
    s+=lcm/M;
    t+=lcm/N;
  }
  if(flag) std::cout << lcm << '\n';
  else std::cout << -1 << '\n';
  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"

using namespace std;

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

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

struct SegmentTree {
private:
	int n;
	vector<int> node;
public:
	SegmentTree(vector<int> v) {
		int sz = v.size();
		n = 1;
		while (n < sz) {
			n *= 2;
		}

		node.resize(2 * n - 1, INT_MAX);
		for (int i = 0; i < sz; i++) {
			node[n + i - 1] = v[i];
		}

		for (int i = n - 2; i >= 0; i--) {
			node[i] = min(node[2 * i + 1], node[2 * i + 2]);
		}
	}

	void update(int x, int val) {
		x += (n - 1);

		node[x] = val;
		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = min(node[2 * x + 1], node[2 * x + 2]);
		}
	}

	int getMin(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) {
			r = n;
		}

		if (r <= a || b <= l) {
			return INT_MAX;
		}

		if (a <= l && r <= b) {
			return node[k];
		}

		int vl = getMin(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = getMin(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}

};

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

	int n, q;
	cin >> n >> q;

	SegmentTree seg(vector<int>(n, INT_MAX));
	for (int i = 0; i < q; i++) {
		int c, x, y;
		cin >> c >> x >> y;

		if (c == 0) {
			seg.update(x, y);
		} else {
			cout << seg.getMin(x, y + 1) << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4052
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
#define INF 100000000
#define ll long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define rep(i, n) for(int (i)=1; (i)<=(n); (i)++)
typedef pair<int, int> P;
int main(){
    int R;
    cin >> R;
    if(R<1200)
        cout << "ABC" << endl;
    else if(1200<=R && R<2800)
        cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}

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


int main()
{
	long long a;
	long long b;
  	double y;
  
	cin >> a;
	cin >> y;

	b = y * 100 + 0.5;
	
	a = a * b;

	a = a / 100;

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


Measured memory_bytes: 3700
/********************    I am only one, but still I am one.    **************************************/
/**************    I cannot do everything, but still I can do something.    *************************/
/***   And because I cannot do everything I will not refuse to do the something that I can do.    ***/
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;



bitset<5001>ldp[5002];
bitset<5001>rdp[5002];
int32_t main(){
	IOS
	int n,k;cin>>n>>k;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	ldp[0][0]=ldp[n+1][0]=1;
	for(int i=1;i<=n;i++){
		ldp[i]=ldp[i-1];
		for(int j=k-a[i];j>=0;j--){
			ldp[i][j+a[i]]=ldp[i][j+a[i]]|ldp[i-1][j];
		}
	}
	rdp[0][0]=rdp[n+1][0]=1;
	for(int i=n;i>=1;i--){
		rdp[i]=rdp[i+1];
		for(int j=k-a[i];j>=0;j--){
			rdp[i][j+a[i]]=rdp[i+1][j]|rdp[i][j+a[i]];
		}
	}
	int cnt = 0;
	for(int i=1;i<=n;i++){
		vector<int>l,r;
		for(int j=0;j<k;j++){
			if( ldp[i-1][j] ){
				l.push_back(j);
			}
			if( rdp[i+1][j] ){
				r.push_back(j);
			}
		}
		int ok = 1;
		for(auto x:l){
			ok &=  x + a[i] < k;
		}
		for(auto x:r){
			ok &= x + a[i] <  k;
		}
		
		
		
		//bug3("\n",i,a[i]);
		//bugn(l,(int)l.size());
		//bugn(r,(int)r.size());
		//bug2("Before:",ok);
		for(auto x:l){
			int id = upper_bound(r.begin(),r.end(),k-x-1)-r.begin()-1;
			if( id >= 0 ){
				ok &=  x + r[id] + a[i] < k; 
			   // bug4(x,k-x,r[id],(x + r[id] + a[i] < k));
			}
		}
		
		if( ok ){
			//bug1("YES");
			cnt++;
		}
			
			
	}
	//bug1(cnt);
	cout<<cnt;
	
	
	
}
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 9904
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	string s;  cin >> s;
	int K;  cin >> K;

	REP(i, s.size()) {
        if (s[i] != 'a') {
            int c = 'z'-s[i]+1;
            if (K >= c) {
                s[i] = 'a';
                K -= c;
            }
        }
    }
    if (K > 0)
        s.back() = 'a' + (s.back()-'a' + K)%26;
  	cout << s << endl;
	return 0;
}


Measured memory_bytes: 592
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int h,w;
vvb a;

int main(){
	while(1){
		cin>>h>>w;
		if(!h&&!w) break;
		a=vvb(h,vb(w));
		for(int i=0;i<h;i++) for(int j=0;j<w;j++){
			int t;
			cin>>t;
			if(t) a[i][j]=1;
		}
		int M=0;
		for(int i=0;i<(1<<h);i++){
			vi b(w);
			for(int j=0;j<h;j++){
				for(int k=0;k<w;k++){
					if(a[j][k]^(i>>j&1)) b[k]++;
				}
			}
			int tmp=0;
			for(int i=0;i<w;i++) tmp+=max(b[i],h-b[i]);
			M=max(M,tmp);
		}
		cout<<M<<endl;
	}
}

Measured memory_bytes: 3184
#include <iostream>

void funcC() {
  //n-cの約数の数
  int n;
  std::cin >> n;
  int cnt = 0;
  for (int c = 1; c < n; c++) {
    int temp = n - c;
    for (int a = 1; a * a <= temp; a++) {
      if (temp % a == 0) {
        if (temp / a != a)cnt += 2;
        else cnt += 1;
      }
    }
  }
  std::cout << cnt;
}

int main(void) {
  funcC();
  return 0;
}

Measured memory_bytes: 3196
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/19/20 20:59:58
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  ll ans = 0;
  for (ll i = 1; i < n; i++) {
    ll d = n/i;
    if (n%i == 0)
      d--;
    ans += max(0ll, d);
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if(a > b) {
    cout << "a > b\n";
  }else if(a < b) {
    cout << "a < b\n";
  }else {
    cout << "a == b\n";
  }
}


Measured memory_bytes: 3060
from bisect import bisect_left, bisect_right

def readinput():
    n,m=list(map(int,input().split()))
    a=list(map(int,input().split()))
    b=[]
    c=[]
    for _ in range(m):
        bb,cc=list(map(int,input().split()))
        b.append(bb)
        c.append(cc)
    return n,m,a,b,c

def main(n,m,a,b,c):
    a.sort()
    for i in range(m):
        #print(a)
        bi=b[i]
        ci=c[i]
        j=bisect_left(a,ci)-1
        if j<0:
            continue
        if j>bi-1:
            save=a[bi:j+1]
            l=j-bi+1
            r=j
            a[l:r+1]=[ci]*(r-l+1)
            a[0:l]=save
        else:
            l=0
            r=j
            a[l:r+1]=[ci]*(r-l+1)

    sum=0
    for i in range(n):
        sum+=a[i]
    
    return sum

def main2(n,m,a,b,c):
    all=[]
    for i in range(n):
        all.append((a[i],1))
    for i in range(m):
        all.append((c[i],b[i]))
    all.sort(reverse=True, key=lambda x:x[0])
    #print(all)
    count=n
    sum=0
    i=0
    while(count>0):
        ni=all[i][1]
        if ni<=count:
            sum+=all[i][0]*ni
            count-=ni
        else:
            sum+=all[i][0]*count
            count=0
        i+=1
        #print(sum,count)
    return sum

if __name__=='__main__':
    n,m,a,b,c=readinput()
    ans=main2(n,m,a,b,c)
    print(ans)


Measured memory_bytes: 39724
import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;

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

bool check(in long[] ans)
{
	long sum = ans.sum;
	foreach (v; ans) {
		long sub = sum - v;
		if (gcd(v, sub) == 1) {
			return false;
		}
	}
	long sub = ans[0];
	foreach (v; ans) {
		sub = gcd(v, sub);
	}
	return sub == 1;
}

void main()
{
	int[] primes = [2];
	for (int i = 3; i <= 30000; ++i) {
		bool yes = true;
		foreach (v; primes) {
			yes &= i % v != 0;
		}
		if (yes) {
			primes ~= i;
		}
	}
	int n = readln.chomp.to!int;
	long[] arr = [2, 3, 4];
	long[] brr = [];
	for (int i = 6; i <= 30000; i += 2) {
		brr ~= i;
	}
	for (int i = 6; i <= 30000; i += 3) {
		brr ~= i;
	}
	std.algorithm.sort = brr;
	brr = std.algorithm.uniq(brr).array;
	long[] ans = arr ~ brr[0..n-3];
	bool[long] done;
	foreach (v; ans[0..$-1]) {
		done[v] = true;
	}
	int index = 2;
	while (true) {
		int ite = primes[index];
		bool flag = false;
		while (true) {
			if (ite > 30000) {
				break;
			}
			if (ite in done) {
				ite += primes[index];
				continue;
			}
			ans[$-1] = ite;
			if (ans.check) {
				flag = true;
				break;
			}
			ite += primes[index];
		}
		if (flag) {
			break;
		}
		index++;
	}
	foreach (i, v; ans) {
		if (i) write = " ";
		v.write;
	}
	writeln;
}


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

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

  int n;
  cin >> n;
  vi d(n);
  rep(i, n)cin >> d[i];

  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  int ans=0, m=101;
  rep(i, n){
    if(m>d[i]){
      ans++;
      m=d[i];
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main(){
//	freopen("input.txt","r",stdin);
	ios::sync_with_stdio(false);
	cin.tie(0);
	LL n,a,b;
	cin>>n>>a>>b;
	if(n==1){
		if(a==b) cout<<"1"<<endl;
		else cout<<"0"<<endl;
	}
	else{
		if(a>b) cout<<"0"<<endl;
		else cout<<(n-2)*b-(n-2)*a+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    l=LIST()
    l=sorted(l)
    ans=0
    for i in range(n):
        for j in range(i,n):
            for k in range(j,n):
                a=l[i]
                b=l[j]
                c=l[k]
                flg=True
                if a==b or b==c or c==a:
                    flg=False
                if a+b<=c:
                    flg=False
                if flg:
                    ans+=1
                    
    print(ans)
    
if __name__ == '__main__':
    do()

Measured memory_bytes: 9224