akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
#define rep(i, n) for(int i = 0; i < n; i++)
const int inf9 = 1e9; const lint inf18 = 1e18;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint P(int n, int r){ if(r < 0 || n < r) return 0; return (fact[n] * inv[n - r] % mod); } lint C(int p, int q){ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }
inline int at(lint i, int j){ return (i >> j) & 1; }

int main(){
    int H, W;
    cin >> H >> W;
    int N;
    cin >> N;
    N = H * W - N;
    int ans = max(H, W);
    for(int i = 1; i <= H; i++){
        ans = max(ans, i + min(W, N / i));
    }
    cout << H + W - ans << endl;
}



Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	N = s.size();
	if (s[0] == s[N - 1]) {
		if (N % 2) cout << "Second\n";
		else cout << "First\n";
	}
	else {
		if (N % 2)cout << "First\n";
		else cout << "Second\n";
	}
	return 0;
}

Measured memory_bytes: 512
/** Hien Jeony **/
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define getbit(n,i) ((n>>(i-1))&1)
#define offbit(n,i) (n^(1<<(i-1)))
#define onbit(n,i) (n|(1<<(i-1)))
#define cntone(x) (__builtin_popcount(x))
const int mod=1e9+7;
using namespace std;
template <typename T> inline void read(T & x)
{
    char c; bool nega=0;
    while((!isdigit(c=getchar()))&&c!='-');
    if(c=='-')
    {
        c=getchar();
        nega=1;
    }
    x=c-48;
    while(isdigit(c=getchar()))
    {
        x=x*10+c-48;
    }
    if(nega) x=-x;
}
template <typename T> void Write(T x) {if (x > 9) Write(x/10); putchar(x%10+48);}
template <typename T> void write(T x) {if (x < 0) {putchar('-'); x = -x;} Write(x);}
string s,t;
int q;
int cntas[100001];
int cntbs[100001];
int cntat[100001];
int cntbt[100001];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("in.inp","r",stdin);
    //freopen("ou.out","w",stdout);
    cin>>s>>t;
    int lenS=s.size();
    int lenT=t.size();
    s=' '+s;
    t=' '+t;
    for(int i=1;i<=lenS;i++)
    {
        cntas[i]=cntas[i-1];
        cntbs[i]=cntbs[i-1];
        if(s[i]=='A') cntas[i]++;
        else cntbs[i]++;
    }
    for(int i=1;i<=lenT;i++)
    {
        cntat[i]=cntat[i-1];
        cntbt[i]=cntbt[i-1];
        if(t[i]=='A') cntat[i]++;
        else cntbt[i]++;
    }
    cin>>q;
    while(q--)
    {
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        int As=cntas[b]-cntas[a-1];
        int Bs=cntbs[b]-cntbs[a-1];
        int At=cntat[d]-cntat[c-1];
        int Bt=cntbt[d]-cntbt[c-1];
        if(((2*As+Bs)%3)==((2*At+Bt)%3))
        {
            cout<<"YES"<<'\n';
        }
        else cout<<"NO"<<'\n';
    }
    return 0;
}


Measured memory_bytes: 2540
#!/usr/bin/env python3
import sys
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(S: str):
    res = sorted(list(set([chr(c) for c in range(ord('a'),ord('z')+1)]) - set(S)))
    return 'None' if len(res) == 0 else res[0]

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    result = solve(S)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(int i = a; i < b; i++)
#define endl "\n"
const int mod = 1e9+7;
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
int power(int a,int b){ int res=1; a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) { return b?gcd(b,a%b):a;}
 
int main()
{    
    sync
    string a, b;
    cin >> a >> b;
    int l1 = a.length(), l2 = b.length();
    int dp[l1+1][l2+1];
    memset(dp, 0, sizeof(dp[0][0])*(l1+1)*(l2+1));
    for(int i = 1; i <= l1; i++)
    {
    	for(int j = 1; j <= l2; j++)
    	{
    		if(a[i-1] == b[j-1])
    			dp[i][j] = dp[i-1][j-1]+1;
    		else
    			dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    	}
    }
    int r = l1, c = l2;
    string ans = "";
    while(r > 0 && c > 0)
    {
    	if(a[r-1] == b[c-1])
    	{
    		ans = a[r-1] + ans;
    		r -= 1;
    		c -= 1;
    	}
    	else if(dp[r-1][c] > dp[r][c-1])
    		r -= 1;
    	else
    		c -= 1;
    	// cout << r << " " << c << endl;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 35456
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>

using namespace std;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* typedef */

typedef long long ll;

/* global variables */

/* function */

/* main */
int main() {

    double a; cin >> a;

    cout << fixed << setprecision(6) << a * a * pi << ' ' << 2 * a * pi << '\n';

}



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

#define inf 0x3f3f3f3f

using namespace std;

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
char ma[105][105];
int h, w, vis[105][105];

void dfs(int x, int y, char c)
{
    int i, xx, yy;

    for(i = 0; i < 4; i++)
    {
        xx = x + dx[i];
        yy = y + dy[i];
        
        if(xx >= 0 && xx < h && yy >= 0 && yy < w && !vis[xx][yy] && ma[xx][yy] == c)
        {
            vis[xx][yy] = 1;
            dfs(xx, yy, c);
        }
    }
}

int main()
{
    int i, j, ans;

    while(scanf("%d%d", &h, &w) && (h || w))
    {
        getchar();

        for(i = 0; i < h; i++) scanf("%s", ma[i]);
        memset(vis, 0, sizeof vis);
        ans = 0;

        for(i = 0; i < h; i++)
        {
            for(j = 0; j < w; j++)
            {
                if(!vis[i][j])
                {
                    ans++;
                    dfs(i, j, ma[i][j]);
                }
            }
        }
        printf("%d\n", ans);
    }

    return 0;
}

Measured memory_bytes: 1724
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    ll w,h,x,y,k;
    string str[3];
	cin>>str[0]>>str[1]>>str[2];
    char c;
    c=str[0][0];
    str[0].erase(str[0].begin());
    while(1){
        //cout<<c;
        if(c=='a') {
            if(str[0][0]=='\0') {
                cout<<'A'<<endl;
                return 0;
            }
            c=str[0][0];
            str[0].erase(str[0].begin());
        }else if(c=='b'){
            if(str[1][0]=='\0') {
                cout<<'B'<<endl;
                return 0;
            }
            c=str[1][0];
            str[1].erase(str[1].begin());
        }else if(c=='c'){
            if(str[2][0]=='\0') {
                cout<<'C'<<endl;
                return 0;
            }
            c=str[2][0];
            str[2].erase(str[2].begin());
        }
    }
    
    return 0;
}



Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

struct edge{
  int to;
  int cost;
};

typedef vector<vector<edge>>  graph;

bool dfs(const graph &g, int v, int dist, vector<int> &d, vector<bool> &vis){
  if(vis[v]){
    return d[v] == dist;//矛盾チェック
  }
  else{
    d[v] = dist;//距離を設定
    vis[v] = true;//訪問済みフラグを立てる
    for(edge next_v : g[v]){
      if(!dfs(g, next_v.to, dist + next_v.cost, d, vis)){
        return false;//一つでも矛盾があればfalseを返し続け終了
      }
      //矛盾なければ次のノードを見る
    }
  }
  return true;
}

signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);

  int n, m;
  cin >> n >> m;

  graph g(n);

  REP(i, m){
    int l,r,d;
    cin >> l >> r >> d;
    l--; r--;
    g[l].push_back( {r, d} );
    g[r].push_back( {l, -d} );
  }

  vector<bool> vis(n, false);
  vector<int> d(n, 0);

  REP(i, n){
    if(!vis[i] && !dfs(g, i, 0, d, vis)){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 17408
alpha = "abcdefghijklmnopqrstuvwxyz"
A = [0]*26

while True :
    try :
        n = input()
        
        for i in range(len(n)) :
            if n[i] in alpha or n[i].lower() in alpha :
                A[alpha.index(n[i].lower())] += 1
    except :
        break
    
for j in range(len(A)) :
    print(alpha[j], ":", A[j])


Measured memory_bytes: 5568
function Main(input){
	input|=0;
	var arr=[11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381];
	var ans="";
	for(var i=0;i<input-1;i=(i+1)|0){ans+=arr[i]+" ";}
	ans+=arr[i];
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 7628
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n1,suma1=0,y1;
	cin>>n1;
	y1=n1*2;
	long long c1[y1];
	for(int i=0;i<y1;i++){
		cin>>c1[i];
		}
	for(int i=0;i<n1;i++){
		if(c1[i]-c1[i+n1]>0){
			suma1=suma1+(c1[i]-c1[i+n1]);
		}
	}
	cout<<suma1;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a=0,b=0,c;
int main()
{
	cin>>c;if(c==5)  a++;else  b++;
	cin>>c;if(c==5)  a++;else  b++;
	cin>>c;if(c==5)  a++;else  b++;
	if(a==2&&b==1)  cout<<"YES";
	else cout<<"NO";
	return 0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

  int n; cin >> n;

  int sum = 0;
  int a[110];

  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }

  double average = double(sum) / n;
  double tmp = INF;
  int ans;

  rep(i, n) {
    tmp = min(tmp, abs(average - a[i]) );
  }

  rep(i, n) {
    if( abs(average - a[i]) == tmp ) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 212345
vi v[N];
int a[N];
int b[N]={};
vi ans;

int main(){
	int n; scanf("%d", &n);
	FOR(i, 1, n+1){
		for(int j = i*2; j <= n; j+=i){
			v[j].EB(i);
		}
	}
	REP(i, n) scanf("%d", a+i+1);
	for(int i=n; i>=1; i--){
		if(b[i]%2!=a[i]){
			ans.EB(i);
			for(int j : v[i]){
				b[j]++;
			}
		}
	}
	printf("%d\n", (int)ans.size());
	for(int i : ans) printf("%d ", i);
}


Measured memory_bytes: 24184
#include <bits/stdc++.h>
 
using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;
 
int main(){
  ll A;
  long double B;
  cin>>A>>B;
  cout << (ll)(A*B) << endl;
  return 0;
}

Measured memory_bytes: 3724
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;


public class my
{
	
	private static StringBuilder sb = new StringBuilder();
	
	public static void Main()
	{
		string s;
		var list = new List<int>();
		
		while( null != ( s = Console.ReadLine() ) ){
			var n = int.Parse(s);
			
			if(list.Count < 3) {
				list.Add(n);
				list.Sort();
			} else {
				for(int i = 0; i < 3; i++) {
					if(n > list[i]) {
						list.RemoveAt(i);
						list.Add(n);
						list.Sort();
						break;
					}
				}
			}
		}

		Console.WriteLine(list[2]);
		Console.WriteLine(list[1]);
		Console.WriteLine(list[0]);
	}
	
	private static int CountChar(string s, char c)
	{
		return s.Length - s.Replace(c.ToString(), "").Length;
	}
	
	private static void Flush()
	{
		Console.Write(sb);
		sb.Length = 0;
	}
	
	private static void AppendLine(int v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(long v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(string[] v)
	{
		sb.AppendLine(string.Join(" ", v));
	}

	private static void Swap(ref string a, ref string b) 
	{
		string tmp = a;
		a = b;
		b = tmp;
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

Measured memory_bytes: 9324
N, K = map(int, input().split())
P = list(map(int, input().split()))
Q = [(p + 1)/2 for p in P]
# print(N, K, P, Q)

ans = s = sum(Q[:K])
for i in range(K, N):
    q0 = Q[i - K]
    q1 = Q[i]
    s += (q1 - q0)
    ans = max(ans, s)
print(ans)


Measured memory_bytes: 77448
from math import floor
N,Y = map(int,input().split(" "))
#x+y+z = N
#10000x+5000y+1000z = Y
#9000x+4000y=Y-1000N
ans = [-1,-1,-1]
for x in range(N+1):
  y = (Y-1000*N-9000*x)/4000
  if y >= 0 and y - floor(y) == 0:
    y = int(y)
    if N - (x + y) >= 0 and 10000*x + 5000*y + 1000*(N-x-y) == Y:
      ans = [int(x),y,int(N-(x+y))]
      break
print(*ans)



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

using namespace std;
//using namespace std::chrono;

#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<long long>

typedef long long ll;

bool check(vi v, int k, double x){
    int kk = 0;
    for(int integer : v){
        kk = ceil(integer/x) - 1;
        if(round(integer / (kk+1)) > x) kk++;

        k -= kk;
    }
    return k >= 0;
}

void print(vi v){
    cout<<"Contents of vector:\n";
    for(auto x : v) cout<<x<<" ";
    cout<<endl<<endl;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); //cout.tie(nullptr);
    //ifstream cin("lmio_1991_3e1_seka_01.in"); ofstream cout("lmio_1991_3e1_seka_01.out");///cia failai

    //int T; cin>>T;
    int T = 1;

    for(int it = 1; it<=T; it++){
        int n, k; cin>>n>>k;
        vi v(n);
        for(int i = 0; i<n; i++) cin>>v[i];

        int l = 0;
        int r = 1000000001;
        int m;
        while (l < r - 1) {
            m = l + (r - l) / 2;
            if (check(v, k, m)) {
                r = m;
            } else {
                l = m;
            }
        }
        cout << r << endl;


    }
}


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

#define each(i, c) for (auto& i : c)

typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;

bool sort_fn(pair<ll, ll> &a, pair<ll, ll> &b) {
  if (a.first == b.first) {
    return a.second < b.second;
  }
  return a.first < b.first;
}

int main() {
  ll n, m;
  cin >> n >> m;

  vector<pair<ll, ll>> ab(m);
  for (ll i = 0; i < m; ++i) {
    ll a, b;
    cin >> a >> b;
    ab[i] = make_pair(a*2, b*2);
  }
  sort(ab.begin(), ab.end(), sort_fn);

  pair<ll, ll> cur = {0, 0};
  ll ans = 0;
  each (i, ab) {
    ll a = i.first + 1;
    ll b = i.second - 1;
    if ((cur.first <= a && a <= cur.second) ||
        (cur.first <= b && b <= cur.second)) {
      if (cur.first < a) cur.first = a;
      if (cur.second > b) cur.second = b;
      continue;
    }

    cur.first = a;
    cur.second = b;
    ++ans;
  }

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

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

int main() {
    int n,m,x;
    scanf("%d%d%d",&n,&m,&x);
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n) {
        scanf("%d",&c[i]);
        rep(j,m) {
            scanf("%d",&a[i][j]);
        }
    }
    int ans = 2000000000;
    for(int i = 0; i < (1 << n); i++) {
        int counter = 0;
        vector<int> d(m,0);
        rep(j,n) {
            if((i >> j) & 1) {
                counter += c[j];
                rep(k,m) {
                    d[k] += a[j][k];
                }
            }
        }
        bool ok = true;
        rep(j,m) {
            if(d[j] < x) {
                ok = false;
            }
        }
        if(ok) {
            ans = min(ans,counter);
        }
    }
    if(ans == 2000000000) {
        cout << -1 << "\n";
    } else {
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 3796
def main():
    S = input()
    w1 = 'dream'[::-1]
    w2 = 'dreamer'[::-1]
    w3 = 'erase'[::-1]
    w4 = 'eraser'[::-1]
    S = S[::-1]
    words = [w1, w2, w3, w4]

    flag = False
    i = 0
    while i < len(S):
        for w in words:
            if S[i:].startswith(w):
                i += len(w)
                flag = True
                break

        if not flag:
            print("NO")
            exit()
        flag = False

    print("YES")



if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

int n;

int main()
{
	scanf("%d",&n);int ans=0;
	for (int i=1;i<=n;i++)
	{
		int x,k;scanf("%d%d",&x,&k);
		while (x%k>0) x-=((x%k-1)/(x/k+1)+1)*(x/k+1);
		ans^=x/k;
	}
	if (ans) puts("Takahashi");
	else puts("Aoki");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmax(x, v) x = max(x, v)
using namespace std;

bool possible[int(pow(10, 5))+1];
int nb_ints, nb_stones;
int value[101];

int main()
{
   cin >> nb_ints >> nb_stones;
   for (int id_int = 0; id_int < nb_ints; ++ id_int)cin>>value[id_int];
   
   for (int nb_cur = 0; nb_cur <= nb_stones; ++ nb_cur)
   {
       for (int id_int = 0; id_int < nb_ints; ++ id_int)
       {
           if (nb_cur >= value[id_int])
                possible[nb_cur] |= !possible[nb_cur - value[id_int]];
       }
   }
   if (possible[nb_stones])cout<<"First";
   else cout << "Second";
   return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int x,y;    
    while(1){{
    cin >> x;
    cin >> y;
    if( x == 0 && y == 0) break;}
    if(x<y){
        cout << x;
        cout << " ";
        cout << y;
    }else{
         cout << y;
        cout << " ";
        cout << x;}
        cout << endl;}
    
}



Measured memory_bytes: 3076
#include <stdio.h>

int CommonDivisor(int,int);

int main()
{
  int x,y,d;
  scanf("%d %d",&x,&y);
  d = CommonDivisor(x,y);
  printf("%d\n",d);
}
int CommonDivisor(int x,int y)
{
  int n,r;
  if(x < y)
    {
      n = x; 
      x = y;
      y = n;
    }
  while(y > 0)
    {
      r = x % y;
      x = y;
      y = r;
    }
  return x;
}



Measured memory_bytes: 2124
import java.util.*;

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

    if(x == 2 || y == 2){
        System.out.println("No");
    }else{
        if(x == 4 || x == 6 || x == 9 || x == 11){
            x=4;
        }else{
            x=1;
        }
        if(y == 4 || y == 6 || y == 9 || y == 11){
            y=4;
        }else{
            y=1;
        }
        if(x==y){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
  }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N; cin >> N;
    FOR(i,1,11) {
        if (i * 1000 - N >= 0) {
            OUT(i * 1000 - N)
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(void){
    char s[4];
    scanf("%s",s);
    for(int i=0;i<3;i++){
        printf("%c",(s[i]=='1')?'9':(s[i]=='9')?'1':s[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll h,m,n,i,s=0,j,k,l,a,p,x=0,y=0;
	cin>>h;
	while(1)
	{
		if(h==1)
		{
			s=s+1;break;
		}
		else
		{
			h=h/2;s=s+1;
		}
	}
	ll zz=0;
	for(i=0;i<s;i++)
	{
		zz=zz+pow(2,i);
	}
	cout<<zz;
}

Measured memory_bytes: 256
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define ll long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<ppi>
#define vll vector<ll>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}


int main()
{      
  fastio();
  int n,m,i,j,t;
  cin>>n>>m;
  double a[n];
  for(i=0;i<n;i++)
  {
  	double x;
  	cin>>x;
	a[i]=(x*(x+1))/2.0;
	a[i]=a[i]/x;
	if(i>0)
		a[i]+=a[i-1];
  }
  double ans=0.0;
  for(i=0;i+m-1<n;i++)
  {
  	double ri=a[i+m-1];
  	double le=((i-1)>=0?a[i-1]:0.0);
  	ans=max(ans,ri-le);
  }
  cout<<fixed<<setprecision(10)<<ans;

  return 0;
}

Measured memory_bytes: 1792
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let k: usize = iterator.next().unwrap().parse().unwrap();
    let a: usize = iterator.next().unwrap().parse().unwrap();
    let b: usize = iterator.next().unwrap().parse().unwrap();
    for n in a..=b {
        if n % k == 0 {
            return "OK".to_string();
        }
    }

    return "NG".to_string();
}


Measured memory_bytes: 2168
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args)  {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		ArrayList<Integer> al = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			al.add(sc.nextInt());
		}
		ArrayList<Integer> x = new ArrayList<>(al);
		Collections.sort(x);
		int tmp1 = x.get(n/2 - 1);
		int tmp2 = x.get(n/2);
		for(int i : al) {
			if(i >= tmp2) {
				System.out.println(tmp1);
			}else {
				System.out.println(tmp2);
			}
		}
	}
}

Measured memory_bytes: 97492
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str;
	while(cin >> str)
	{
		if(str[0] == '#')
		{
			break;
		}
		int size = str.size();
		bool right_flag;
		if(str[0] == 'y' || str[0] == 'u' || str[0] == 'i' || str[0] == 'o' || str[0] == 'p' || 
		   str[0] == 'h' || str[0] == 'j' || str[0] == 'k' || str[0] == 'l' || 
		   str[0] == 'n' || str[0] == 'm')
		{
			right_flag = true;
		}
		else
		{
			right_flag = false;
		}
		int count = 0;
		for(int i = 0; i < size; ++i)
		{
			if(str[i] == 'y' || str[i] == 'u' || str[i] == 'i' || str[i] == 'o' || str[i] == 'p' || 
			   str[i] == 'h' || str[i] == 'j' || str[i] == 'k' || str[i] == 'l' || 
			   str[i] == 'n' || str[i] == 'm')
			{
				if(right_flag == false)
				{
					right_flag = true;
					count++;
				}
			}
			else
			{
				if(right_flag == true)
				{
					right_flag = false;
					count++;
				}
			}
		}
		cout << count << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
	int n;
	int data[20][20];
	while(cin>>n){
		if(n==0)break;
		for(int i=0;i<n+1;i++){
			for(int j=0;j<n+1;j++){
				data[i][j]=0;
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cin>>data[i][j];
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				data[i][n]=data[i][n]+data[i][j];
				data[n][j]=data[n][j]+data[i][j];
			}
		}
		for(int i=0;i<n;i++){
			data[n][n]=data[n][n]+data[i][n];
		}
		for(int i=0;i<n+1;i++){
			for(int j=0;j<n+1;j++){
				printf("%5d",data[i][j]);
			}printf("\n");
		}
	}
	
}

Measured memory_bytes: 1164
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
from fractions  import gcd

#input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
b=[0]*((n+1)//2)
c=[0]*(n//2)

for i in range((n+1)//2):
    b[i]=a[i*2]
for i in range(n//2):
    c[i]=a[i*2+1]
c.reverse()
c.extend(b)
if n%2==1:
    c.reverse()
print(*c)

Measured memory_bytes: 122776
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  int n,m;cin >> n >> m;
  int lmx=0;
  int rmi=101010;

  reps(i,m){
    int l,r;cin >> l >> r;
    lmx=max(lmx,l);rmi=min(rmi,r);
  }
  
  
  int ans=rmi-lmx+1;
  if(ans>=0)cout << ans;
  else cout << 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String n, ans = "Good";

		n = s.next();
		String m[] = n.split("");

		for (int i = 0; i < m.length - 1; i++) {
			if (m[i].equals(m[i + 1])) {
				ans = "Bad";
			}
		}
		System.out.println(ans);
	}
}


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).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; }

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


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

    ll a; cin>>a;
    cout<<a+a*a+a*a*a<<endl;

    return 0;

}

Measured memory_bytes: 3584
MOD=10**9+7
UPPERLIMIT=2*10**5
MODMUL=[1, 1]+[0]*(UPPERLIMIT-1)
for i in range(2, UPPERLIMIT+1):
  MODMUL[i]=MODMUL[i-1]*i%MOD
MODDIV=[1]*UPPERLIMIT+[pow(MODMUL[-1], MOD-2, MOD)]
for i in range(UPPERLIMIT, 0, -1):
  MODDIV[i-1]=MODDIV[i]*i%MOD
def MODCOMB(n, r):
  return (((MODMUL[n]*MODDIV[r])%MOD)*MODDIV[n-r])%MOD

N, M=map(int, input().split())

from collections import defaultdict
def PrimeFactorization(x):
  out=defaultdict(int)
  for i in range(2, int(pow(x, 1/2))+1):
    while x%i==0:
      out[i]+=1
      x//=i
  if x>1:
    out[x]+=1
  return out

primenums=PrimeFactorization(M)
ans=1
for x in primenums.values():
  ans*=MODCOMB(N+x-1, N-1)
  ans%=MOD
  
print(ans)

Measured memory_bytes: 76016
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

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

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

int main() {
    int n;
    cin >> n;
    vector<ll> t(n);
    rep(i, n) cin >> t[i];
    ll lcd_num = t[0];
    for (int i = 1; i < n; ++i) {
        lcd_num = lcd(lcd_num, t[i]);
    }
    cout << lcd_num << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n, k;
	cin >> n >> k;
	int v[100];
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	int ans = 0;
	for(int l = 0; l <= n; l++){
		for(int r = 0; l + r <= min(n, k); r++){
			priority_queue<int> qu;
			for(int i = 0; i < l; i++){
				qu.push(-v[i]);
			}
			for(int i = 0; i < r; i++){
				qu.push(-v[n - 1 - i]);
			}
			for(int i = 0; l + r + i < k; i++){
				if(qu.empty()) break;
				if(qu.top() < 0) break;
				qu.pop();
			}
			int res = 0;
			while(!qu.empty()){
				res -= qu.top();
				qu.pop();
			}
			// cout << l << " " << r << " " << res << endl;
			ans = max(ans, res);
		}
	}
	cout << ans << endl;
}

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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int m = n / 2 * 2 + 1;
        System.out.println(n * (n - 1) / 2 - n / 2);
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (j != m - i) {
                    System.out.println(i + " " + j);
                }
            }
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 25556
x = int(input())
num = [1,1001]
for i in range(2,33):
    j = 2
    while i**j<=1000:
        num.append(i**j)
        j += 1
num = sorted(num)

def binary_search(li,k):
    left = 0
    right = len(li)
    while left < right:
        mid = (left+right)//2
        if li[mid]<=x and x<li[mid+1]:
            return li[mid]
        elif li[mid] < x:
            left = mid+1
        else:
            right = mid
print(binary_search(num,x))

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

int main(int argc, char *argv[])
{
	static char S[100032];
	char *p = S;
	fgets(S, sizeof(S), stdin);

	while ( *p != '\0' && *p != '\n' ){
		if ( strncmp(p, "erase", 5) == 0 ){
			if ( *(p+5) == 'r' ){
				p += 6;
			} else if ( *(p+5) == 'd' || *(p+5) == 'e' ){
				p += 5;
			} else if ( *(p+5) == '\n' ){
				break;
			} else {
				printf("NO\n");
				return 0;
			}
		} else if ( strncmp(p, "dream", 5) == 0 ){
			if ( *(p+5) == 'd' ){
				p += 5;
			} else if ( *(p+5) == 'e' ){
				if ( strncmp(p+5, "erase", 5) == 0 ){
					p += 5;
				} else if ( *(p+6) == 'r' ){
					p += 7;
				} else {
					printf("NO\n");
					return 0;
				}
			} else if ( *(p+5) == '\n' ){
				break;
			} else {
				printf("NO\n");
				return 0;
			}
		} else {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;


int a[200*1000+3];
int main() {
    deque<int> mydeque;
    int n;cin>>n;
    for(int i=1;i<=n;++i)cin>>a[i];
    for(int i=1;i<=n;++i){
        if((i&1)!=(n&1)){//diff parity
            mydeque.push_back(i);
        }else{//same parity
            mydeque.push_front(i);
        }
    }
    for(auto it:mydeque){
        cout<<a[it]<<" ";
    }
    cout<<"\n";
  return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
int W,a,b;
cin >> W >> a >> b;
if(b-a-W < 0 && a-b-W < 0){
cout << "0" << endl;
}else{
cout << max(a,b) -min(a,b) -W << endl;
}
return 0;
}

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

int main(){
	int N, M, Q; cin >> N >> M >> Q;

	vector<vector<int>> sum(N+1, vector<int>(N+1));
	for(int i=0; i<M; ++i){
		int l, r; cin >> l >> r;
		sum[l][r] += 1;
	}

	for(int i=1; i<N+1; ++i){
		for(int j=1; j<N+1; ++j){
			sum[i][j] += sum[i][j-1] + sum[i-1][j] - sum[i-1][j-1];
		}
	}

	while(Q--){
		int p, q; cin >> p >> q;

		cout << sum[q][q] - sum[q][p-1] - sum[p-1][q] + sum[p-1][p-1] << endl;
	}
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int H, W, N;
map<pair<int,int>, int> A;
int main() {
	cin >> H >> W >> N;
	for (int i = 0; i < N; ++ i) {
		int a, b;
		cin >> a >> b;
		for (int x = -2; x <= 0; ++ x) for (int y = -2; y <= 0; ++ y) {
			++ A[{a+y, b+x}];
		}
	}
	vector<long long> r(10);
	for (auto p : A) {
		int y = p.first.first;
		int x = p.first.second;
		if (1 <= y && y <= H-2 && 1 <= x && x <= W-2) {
			++ r[p.second];
		}
	}
	r[0] = (long long)(H-2) * (W-2);
	for (int i = 1; i <= 9; ++ i) r[0] -= r[i];
	for (auto x : r) {
		cout << x << endl;
	}
}


Measured memory_bytes: 56448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main()
{
    int n,k;
    cin >>n >>k;
    vector<ll> w(n),d(n);
    rep(i,n) cin >>w[i] >>d[i];

    ll l=0, r=LLONG_MAX/3;
    while(r-l>1)
    {
        ll m = (l+r)/2;
        ll ct = 0;
        rep(i,n)
        {
            ll v = m-w[i];
            if(v<0) continue;

            ll p = v/d[i];
            ct += p+1;
        }

        if(ct<k) l = m;
        else r = m;
    }

    cout << r << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  for (int i = 1; i < N; ++i) {
    A[i] += A[i - 1];
  }
  ll ans = LLINF;
  for (int i = 0; i < N - 1; ++i) {
    ans = min(ans, abs(A[i] - (A[N - 1] - A[i])));
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {
    int a, b; cin >> a >> b;
    for (int i = 0; i < to_string(b).size(); i++) a *= 10;
    a += b, b = sqrt(a+1);
    if (a == b*b) cout << "Yes" << endl;
    else          cout << "No"  << endl;
    return 0;
}


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

long long n;
long double sum = 0;
vector<long long> v;

int main() {
  cout << fixed << setprecision(10);
  cin >> n;
  v.resize(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  for(int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    v[i] = abs(x - v[i]);
  }
  for(int i = 0; i < n; ++i) sum += v[i];
  cout << sum << endl;
  sum = 0;
  for(int i = 0; i < n; ++i) sum += v[i] * v[i];
  cout << sqrtl(sum) << endl;
  sum = 0;
  for(int i = 0; i < n; ++i) sum += v[i] * v[i] * v[i];
  cout << pow(sum, 1.0L / 3.0L) << endl;
  sum = 0;
  for(int i = 0; i < n; ++i)
    sum = max(sum, (long double)v[i]);
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3480
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] strlist = str.split(" ");

		int answer = 3;

		if(strlist[0].equals(strlist[1])){
			answer = answer - 1;
		}

		if(strlist[1].equals(strlist[2])){
			answer = answer - 1;
		}

		if(strlist[2].equals(strlist[0])){
			answer = answer - 1;
		}

		if(answer == 0){
			answer = 1;
		}

		System.out.println(answer);

	}

}


Measured memory_bytes: 21076
#include<stdio.h>
    #include<string.h>
    int main(void){
    int A,B,C,D,E,N,M,x,y,i,j,cou=0,cou2,v[1000000],w[1000000],min_i,en=0;
        char S[100],W[100],s[10],X,Y;
       scanf("%s%s%s",&S);
       if(S[0]=='1'){
           cou++;
       }
       if(S[1]=='1'){
           cou++;
       }
       if(S[2]=='1'){
           cou++;
       }
       printf("%d",cou);
       return 0;
    }

Measured memory_bytes: 128
import heapq

N=int(input())
count=0
que=[3,5,7]
heapq.heapify(que)
ans=[]
while True:
    x=heapq.heappop(que)
    if N>=x:
        count+=1
        ans.append(x)
    else:
        break
    heapq.heappush(que,10*x+3)
    heapq.heappush(que,10*x+5)
    heapq.heappush(que,10*x+7)

count=0
check=["3","5","7"]
for i in ans:
    for j in check:
        if str(i).count(j)==0:
            break
    else:
        count+=1

print(count)

Measured memory_bytes: 46168
#include<stdio.h>
#include<stdlib.h>

#define k 10001

void CountingSort(int *,int *,int);

int main(){
  int i,n,*A,*B;

  scanf("%d",&n);
  A=(int *)malloc(n*sizeof(int));
  B=(int *)malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  
  CountingSort(A,B,n);

  for(i=0;i<n;i++){
    printf("%d",B[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n");

  free(A);
  free(B);

  return 0;
}

void CountingSort(int *A,int *B,int n){
  int i;
  int *C;
  
  C=(int *)malloc(k*sizeof(int));
  for(i=0;i<k;i++) C[i]=0;

  for(i=0;i<n;i++) C[A[i]]++;

  for(i=1;i<k;i++) C[i]=C[i]+C[i-1];

  for(i=n-1;i>=0;i--){
    B[C[A[i]]-1]=A[i];
    C[A[i]]--;
  }

  free(C);
}



Measured memory_bytes: 17216
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int x;
int cnt=0;
long long len=2;
long long sum=0;
cin>>x;
for(int i=1;i<=x;i++)
{
	sum=2+(len<<=1);
	len=sum;
}
cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 50;
int n;
ll a[maxn];
map<ll, ll> mp;
int main()
{
    std::ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    sort(a, a + n);
    ll gcd = a[0];
    for(int i = 1;i < n;i++){
        gcd = __gcd(gcd, a[i]);
    }
    bool ok = true;
    for(int i = 0;i < n;i++){
        ll now = a[i];
        for(ll j = 2;j * j <= now;j++){
            if(now % j == 0LL){
                if(mp[j] || mp[now / j]){
                    ok = false;
                    break;
                }
                mp[j] = 1;
                mp[now / j] = 1;
            }
        }
        mp[now] = 1;
        
    }
    if(ok) cout << "pairwise coprime\n";
    else if(gcd == 1LL) cout << "setwise coprime\n";
    else cout << "not coprime\n";
    return 0;
}

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

vector<ll> enumDivisor(ll n)
{
	vector<ll> res;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (i * i != n) res.push_back(n / i);
	}
	return res;
}

int main()
{
	ll n;
	cin >> n;
	int ans = 0;
	for (ll x : enumDivisor(n)) {
		if (x == 1) continue;
		ll tmp = n;
		while (tmp % x == 0)
			tmp /= x;
		tmp %= x;
		if (tmp == 1) {
			++ans;
			cerr << "  1: " << x << endl;
		}
	}
	for (auto &&x : enumDivisor(n-1)){
		cerr << "  2: " << x << endl;
	}
	
	ans += enumDivisor(n - 1).size() - 1;
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  bool x = true;
  for(int i=0;i<50000;i++){
    if(floor(i*1.08) == N){
      cout << i << endl;
      x = false;
      break;
    }
  }
    if(x)
      cout << ":(" << endl;
      
}


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

using namespace std;
typedef long long ll;

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

  ll ans = 1;
  while ((ans + 1) * (ans + 1) <= n) {
    ans++;
  }
  cout << ans * ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[105],t[105];
int main(){
	scanf("%s%s",s+1,t+1);
	int l=strlen(s+1);
	int i=1;
	for(int j=1;j<=l;j++)
		if(s[i]==t[j]){
			int a=i+1,b=j+1;
			if(a>l)a-=l;
			if(b>l)b-=l;
			while(s[a]==t[b]){
				a++,b++;
				if (a>l) a-=l;
				if (b>l) b-=l;
				if (a==i){
					puts("Yes");
					return 0;
				}
			}
		}
	puts("No");
	return 0;
}


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

int a,b;

int main(){
cin >> a >> b;
int x = a+b;
int y = a-b;
int z = a*b;
if(x >= y && x >= z){
cout << x ;
}else
if(y >= x && y >= z){
cout << y ;
}else
if(z >= y && z >= x){
cout << z;
}
cout << endl;
}

Measured memory_bytes: 256
n,m,c = gets.split(" ").map{|e| e.to_i}
b = gets.split(" ").map{|e| e.to_i}
count = 0

n.times do
  a = gets.split(" ").map{|e| e.to_i}
  sum = c
  m.times do|i|
    sum += a[i]*b[i]
  end

  count += 1 if sum > 0
end

puts count

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define pb push_back

#define rep(i, l, n) for (int i = (l); i < n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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

const int MOD = 1000000007;

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

using Graph = vector<vector<int>>;

Graph G;

vector<bool> seen;
void dfs(const Graph &G, int v)
{
    seen[v] = true;

    for (auto next_v : G[v])
    {
        if (seen[next_v])
            continue;
        dfs(G, next_v);
    }
}

const int MAX_N = 110000;
int memo[MAX_N];

ll rec(int n)
{
    if (n == 0)
    {
        return 0;
    }
    if (memo[n] != -1)
    {
        return memo[n];
    }

    ll res = INF;

    for (int pow6 = 1; pow6 <= n; pow6 *= 6)
    {
        res = min(res, rec(n - pow6) + 1);
    }
    for (int pow9 = 1; pow9 <= n; pow9 *= 9)
    {
        res = min(res, rec(n - pow9) + 1);
    }
    return memo[n] = res;
}

int main()
{
    int n;
    cin >> n;
    rep(i, 0, MAX_N)
    {
        memo[i] = -1;
    }
    cout << rec(n) << endl;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((c > a)&& (c > b)) cout << a*b/2 << endl;
  else if (a > b) cout << b*c/2 << endl;
  else cout << a*c/2 << endl;
}

Measured memory_bytes: 256