akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

lli add(lli a, lli b) {
	a += b;
	if (a >= mod) a -= mod;
	return a;
}

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
	if(m==n){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

		int[][] map = new int[10][10];
		for (int i = 1; i <= N; i++) { // Aの探索
			String s = String.valueOf(i);
			int f = Integer.parseInt(s.substring(0, 1));
			int l = Integer.parseInt(s.substring(s.length() - 1));
			map[f][l]++; // 先頭と末尾の桁を記録
		}

		long ans = 0;
		for (int i = 1; i <= N; i++) { // Bの探索
			String s = String.valueOf(i);
			int revF = Integer.parseInt(s.substring(s.length() - 1));
			int revL = Integer.parseInt(s.substring(0, 1));
			ans += map[revF][revL]; // 一致するものを数える
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 43028
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string S;
int X[1000005][3];
int z=0;
int y=0;
int main()
{
	cin >> S;
	if(S[0]=='J'){
		X[z][0]++;
		y=0;
	}
	if(S[0]=='O'){
		X[z][1]++;
		y=1;
	}
	if(S[0]=='I'){
		X[z][2]++;
		y=2;
	}
	for(int i=1;i<S.length();i++){
		if(S[i-1]==S[i])X[z][y]++;
		else{
			z++;
			if(S[i]=='J')y=0;
			if(S[i]=='O')y=1;
			if(S[i]=='I')y=2;
			X[z][y]++;
		}
	}
	int ans=0;
	for(int i=0;i<=z;i++){
		if(X[i][0]<X[i+1][1])continue;
		if(X[i+1][1]>X[i+2][2])continue;
		ans=max(ans,X[i+1][1]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 13916
#include <stdio.h>

int main()
{
	int a[105];
	int N;
	int i,j,k;
	int x,y,z;
	int count=0;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	if(N<3){printf("0");return 0;}
	
	for(i=0;i<N;i++){
		for(j=0;j<i;j++){
			for(k=0;k<j;k++){
				if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]){
					x=a[i];y=a[j];z=a[k];
					if(x+y>z&&y+z>x&&z+x>y){count++;}
				}
			}	
		}
	}
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 1704
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    string S; cin >> S;
    if(S.length() < 4){
        cout << "No" << endl;
        return 0;
    }
    bool okay = true;
    if(S[0] != 'Y') okay = false;
    if(S[1] != 'A') okay = false;
    if(S[2] != 'K') okay = false;
    if(S[3] != 'I') okay = false;
    cout << (okay ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int ans=0;
	for(int i=0;i<s1.length();i++){
		if(s1[i]==s2[i]){
			ans++;
		}
	}
	printf("%d\n",ans);
}

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

const int MOD = 1e9 + 7;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w;
    cin >> h >> w;
    vector<vector<bool>> grid(h+1, vector<bool> (w+1));
    for (int i = 1; i <= h; i++) {
        string row;
        cin >> row;
        for (int j = 1; j <= w; j++) {
            grid[i][j] = row[j-1] == '.';
        }
    }
    
    vector<vector<int>> paths(h+1, vector<int> (w+1));
    paths[1][1] = 1;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (!grid[i][j]) continue;
            paths[i][j] += paths[i-1][j] + paths[i][j-1];
            if (paths[i][j] >= MOD) paths[i][j] -= MOD;
        }
    }
    cout << paths[h][w] % MOD << endl;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long int
#define f first
#define s second
#define pb push_back
#define PII pair<ll,ll>
ll const MOD = 1000000007;
ll const N = 1000005;
ll const LN = 20;
ll const inf = 8e18;
using namespace std;

ll n, m, a[N];



int main()
{
	ios::sync_with_stdio (false);
	cin.tie (NULL);
	ll n;
	cin >> n;
	string str;
	cin >> str;
	map<ll, ll>mp;
	for (auto w : str) { mp[w]++; }
	ll ans = 1;
	for (auto w : mp)
	{
		ans *= (w.s + 1);
		ans %= MOD;
	}
	ans--;
	if (ans < 0) { ans += MOD; }
	cout << ans;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n, a, b, c, d;
	string s;
	cin >> n >> a >> b >> c >> d;
	cin >> s;
	for (int i = a - 1; i < c;i++)if (s.substr(i, 2) == "##") {
		cout << "No" << endl;
		return 0;
	}
	for (int i = b - 1; i < d; i++)if (s.substr(i, 2) == "##") {
		cout << "No" << endl;
		return 0;
	}
	bool ans = false;
	if (d < c) {
		for (int i = b - 2; i < d - 1; i++) {
			if (s.substr(i, 3) == "...")ans = true;
		}
	}
	else ans = true;
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 3744
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[n];
		int[] num = new int[n];
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
			num[a[i]-1]++;
		}
		Arrays.sort(num);
		int sum = 0;
		for(int i=n-1; i>=n-k; i--){
			sum += num[i];
		}
		System.out.println(n-sum);
	}
}

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, x;
  cin >> n >> x;
  vector <int> L(n + 1);
  for (int i = 1; i <= n; i++) cin >> L[i];
  vector <ll> D(n + 2, 0);
  for (int i = 2; i <= n + 1; i++) {
    D[i] = D[i - 1] + L[i - 1];
    if (D[i] > x) {
      cout << i - 1 << endl;
      return (0);
    }
  }
  cout << n + 1 << endl;
  return (0);
}


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

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  ll n = s.sz/2;
  ll ans = 0;
  rep(i,0,n){
    if(s[i]!=s[s.sz-1-i])ans++;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;


const int MOD = 998244353;

int sum(int a, int b)
{
    a += b;
    if (a >= MOD) a -= MOD;
    return a;
}
int sub(int a, int b)
{
    a -= b;
    if (a < 0) a += MOD;
    return a;
}
int mult(int a, int b)
{
    return (a * 1LL * b) % MOD;
}

const int N = 2e5 + 5;

int n;
char s[N];
int x[N];
int num[N];

int g[N];

void calc(int k)
{
    if (!((n / k) & 1))
        return;

    g[k] = sum(g[k], num[k]);
    for (int i = 0; i < n; ++i)
    {
        int cur = x[i % k] ^ ((i / k) & 1);
        if (cur < x[i])
            break;
        if (cur > x[i])
            return;
    }
    g[k] = sum(g[k], 1);
}

int main()
{
    //freopen("input.txt", "r", stdin);


    scanf("%d%s", &n, s);
    int m = strlen(s);

    for (int i = 0; i < n - m; ++i)
        x[i] = 0;
    for (int i = n - m; i < n; ++i)
        x[i] = s[i - (n - m)] - '0';

    num[0] = 0;
    for (int i = 0; i < n; ++i)
        num[i + 1] = sum(mult(2, num[i]), x[i]);

    for (int k = 1; k * k <= n; ++k)
    {
        if (n % k) continue;
        calc(k);
        if (k * k != n)
            calc(n / k);
    }

    for (int i = 1; i <= n; ++i)
        for (int j = i + i; j <= n; j += i)
        {
            if (n % j == 0 && ((n / j) & 1))
                g[j] = sub(g[j], g[i]);
        }

    int ans = 0;
    for (int i = 1; i <= n; ++i)
        ans = sum(ans, mult(2 * i, g[i]));
    printf("%d", ans);

}


Measured memory_bytes: 2048
s = input() + '?'

ans = 0
n_a = 0
n_bc = 0
i = 0
while(i<len(s)):
    if(s[i:i+2]=='BC'):
        n_bc += 1
        i += 2
        continue
    else:
        ans += n_a * n_bc
        n_bc = 0
        if(s[i]=='A'):
            n_a += 1
        else:
            n_a = 0
        i += 1

print(ans)

Measured memory_bytes: 41200
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s = new String[N];
        for (int i = 0; i < N; i++) {
            s[i] = sc.next();
        }
        int startWithB_and_endWithA = 0;
        int startWithB = 0;
        int endWithA = 0;
        int internalAB = 0;
        for (int i = 0; i < N; i++) {
            boolean start_b = s[i].charAt(0) == 'B';
            boolean end_a = s[i].charAt(s[i].length()-1) == 'A';
            if (start_b && end_a) {
                startWithB_and_endWithA++;
            } else if (start_b) {
                startWithB++;
            } else if (end_a) {
                endWithA++;
            }
            for (int j = 0; j < s[i].length() - 1; j++) {
                if(s[i].charAt(j) == 'A' && s[i].charAt(j+1) == 'B') {
                    internalAB++;
                }
            }
        }
        int ans = 0;
        if(startWithB_and_endWithA == 0) {
            ans += internalAB + Math.min(startWithB, endWithA);
        } else {
            ans += internalAB + startWithB_and_endWithA - 1;
            if (startWithB > 0) {
                ans++;
                startWithB--;
            }
            if (endWithA > 0) {
                ans++;
                endWithA--;
            }
            ans += Math.min(startWithB, endWithA);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 30340
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <complex>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
int H,W;
int Arr[1010][1010];
bool vis[1010][1010]={};
int N,k=0;
int color[100000];
int cnt=0;
bool valid(int i, int j)
{
    return i>=0 && i<H && j>=0 && j<W;	   // edit it to appropriate the problem
}

void traverse(int r, int c)
{
    if( !valid(r, c) || vis[r][c] || k>=N )
        return;		// invalid position or block position

    if(cnt>=color[k])
    {
        k++;
        cnt=0;
    }

    vis[r][c] = true;	// we just visited it, don't allow any one back to it
    Arr[r][c]=k+1;
    cnt++;

    // Try the 4 neighbor cells
    traverse(r, c+1);
    traverse(r+1, c);
    traverse(r, c-1);
    traverse(r-1, c);
}



int main()
{
    cin >> H >> W;

    cin >> N;
    for(int i=0; i<N; i++)
    {
        cin >> color[i];
    }
    traverse(0,0);
    for(int i=0; i<H; i++)
    {
        for(int j=0; j<W; j++)
        {
            cout << Arr[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define sz(a) int((a).size())
#define fr(i,n) for(int i=0;i<n;i++) 
#define rf(i,n) for(int i=1;i<=n;i++) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define MAX INT_MAX 
#define f first
#define s second
using namespace std;
#define M 1000000007
int main()
{
    int n;
    cin>>n;
    std::vector<int> v(n);
    fr(i,n)
    cin>>v[i];
    int dp[n+1];
    memset(dp,INT_MAX,sizeof(dp));
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);
    for(int i=2;i<n;i++)
        dp[i] = min(abs(v[i]-v[i-1])+dp[i-1], abs(v[i]-v[i-2])+dp[i-2]);

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

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

using namespace std;

const int N = 110;

int q[N];

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

    for (int i = 0; i < n; i ++ )
        cin >> q[i];

    sort(q,q+n);

    cout << q[n-1] - q[0] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);
    int ans = 0;
    char s[6];
    for (int i = 1; i <= n; i++) {
        snprintf(s, 6, "%d", i);
        int sum = 0;
        for (char *p = s; *p; p++) {
            sum += (*p - '0');
        }
        if (a <= sum && sum <= b) ans += i;
    }
    printf("%d\n", ans);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
//#include<cstdio>
//#include<algorithm>
//#include<cmath>
#define maxn 55
const double eps =1e-10;
const double g =9.8;
using namespace std;

int N,V,X,Y;
int L[maxn],B[maxn],R[maxn],T[maxn];

int dcmp(double d){
	if(d<-eps) return -1;
	else if(d>eps) return 1;
	else return 0;
}

double cal(double vy,double t){
	return vy*t-0.5*g*t*t;
}

int cmp(double lb,double ub,double a){
	return a-lb<-eps?-1:ub<a+eps?1:0;
}

bool check(double qx,double qy){
	double a=0.25*g*g,b=g*qy-V*V,c=1.0*qx*qx+qy*qy;
	double D=b*b-4*a*c;
	if(dcmp(D)==0) D=0;
	if(D<0) return false;
	for(int d=-1;d<=1;d+=2){
		double t2=(-b+d*sqrt(D))/2/a;
		if(t2<=0) continue;
		double t=sqrt(t2);
		
		double vx=qx/t,vy=(qy+0.5*g*t*t)/t;
		double yt=cal(vy,X/vx);
		if(dcmp(yt-Y)<0) continue;
		
		bool ok=true;
		for(int i=0;i<N;i++){
			if(L[i]>=X) continue;
			if(R[i]==X&&Y<=T[i]&&B[i]<=yt) ok=false;
			
			int yL=cmp(B[i],T[i],cal(vy,L[i]/vx)),
		     	yR=cmp(B[i],T[i],cal(vy,R[i]/vx)),
		     	xH=cmp(L[i],R[i],vx*(vy/g)),
		     	yH=cmp(B[i],T[i],cal(vy,vy/g));
		    if(xH==0&&yH>=0&&yL<0) ok=false;
		    if(yL*yR<=0) ok=false;
		}
		if(ok) return true;
	}
	return false;
}

void slove(){
	for(int i=0;i<N;i++)
		R[i]=min(X,R[i]);
	bool ok=check(X,Y);
	for(int i=0;i<N;i++){
		ok|=check(L[i],T[i]);
		ok|=check(R[i],T[i]);
	}
	printf("%s\n",ok?"Yes":"No");
}

void MAIN()
{
	scanf("%d%d%d%d",&N,&V,&X,&Y);
	for(int i=0;i<N;i++) scanf("%d%d%d%d",&L[i],&B[i],&R[i],&T[i]);
	slove();
}

int main()
{
//	freopen("in#pro.txt","r",stdin);
//	freopen("out#pro.txt","w",stdout);
	MAIN();
	return 0;
}

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

int gcd(int x, int y){
  if(y==0)
    return x;

  return gcd(y, x%y);
}

int main(){
  int x, y;
  cin >> x >> y;

  int g = gcd(x, y);

  cout << (x+1)+(y+1)-(g+1) << endl;

  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    vector<string> s(3);
    rep(i, 3) cin >> s[i];
    cout << s[0][0] << s[1][1] << s[2][2] << "\n";
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    string t;
    cin >> t ;
    rep(i,t.size()){
        if(t[i]=='?') t[i]='D';
    }
    cout << t << endl;
    return 0;
}

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


int main() {
    int N; cin >> N;
    vector<long long> monsters(N + 1);
    for (int i = 0; i < N + 1; i++) {
        cin >> monsters[i];
    }
    vector<long long> beatable(N);
    for (int i = 0; i < N; i++) {
        cin >> beatable[i];
    }

    long long ans = 0;
    for (int i = 0; i < N; i++) {
        if (monsters[i] >= beatable[i]) {
            ans += beatable[i];
        } else {
            ans += monsters[i];
            beatable[i] -= monsters[i];
            if (monsters[i + 1] >= beatable[i]) {
                ans += beatable[i];
                monsters[i + 1] -= beatable[i];
            } else {
                ans += monsters[i + 1];
                monsters[i + 1] = 0;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
using namespace std;

/* debug macros */
#ifdef WAFDAYO
#define DBG_PRINT(s, t, u) { std::cerr << s << " \e[2m=\e[m \e[1m" << t << "\e[m" << u; }
#else
#define DBG_PRINT(s, t, u) {}
#endif
#define dbg(x) DBG_PRINT(#x, x, std::endl)
#define dbgc(x) DBG_PRINT(#x, x, ", ")
#define idbg(x, i) DBG_PRINT(#x "[" << i << "]", x[i], std::endl)
#define idbgc(x, i) DBG_PRINT(#x "[" << i << "]", x[i], ", ")

/* IO utilities */
struct read_item { read_item() {}; template<class T> operator T() { T t; std::cin >> t; return t; } };

/* types and constants */
typedef long long i64;
const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

int main() {

	const int n = read_item();
	vector<string> s(n);
	vector<int> t(n);
	for(int i = 0; i < n; i++) {
		string tmp = read_item();
		s[i] = tmp;
		t[i] = read_item();
	}
	const string x = read_item();

	int ans = 0;
	int it = 0;
	while(s[it] != x) {
		it += 1;
	}
	for(int i = it + 1; i < n; i++) {
		ans += t[i];
	}

	printf("%d\n", ans);

	return 0;
}

/* wafdayo~~~ */


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int a,i=0,b;
  while(1){
    i=0;
    cin>>a;
    if(a==0)break;
    b=1000-a;
    if(b>=500){
      i=b/500;
      b=b%500;
    }
    if(b>=100){
      i+=b/100;
      b=b%100;
    }
    if(b>=50){
      i+=b/50;
      b=b%50;
    }
    if(b>=10){
      i+=b/10;
      b=b%10;
    }
    if(b>=5){
      i+=b/5;
      b=b%5;
    }
    if(b>=1){
      i+=b/1;
    }
    cout<<i<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
using namespace std;
 
int main()
{
	int n;
	cin >> n;
	if (n >= 30)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}

  	return 0;
}

Measured memory_bytes: 3620
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 2005;

vector<int> T[N];
bool has[N];

int n;

int mn[N];
int sum[N];
int cnt[N];

void dfs(int node, int par){    
    cnt[node]=has[node];
    pii ww = mp(0,0);
    for(auto x : T[node]){
        if(x==par)
            continue;
        dfs(x,node);
        sum[node] += cnt[x] + sum[x];
        ww = max(ww,mp(cnt[x] + mn[x], cnt[x] + sum[x]));
        cnt[node] += cnt[x];
    }
    
    if(ww.fi > sum[node] - ww.se){
        mn[node] = ww.fi - (sum[node] - ww.se);
    }
    else{
        mn[node] = sum[node]%2;
    }
}


int calc(int nd){
    for(int i = 1; i <= n; i ++ ){
        mn[i]=0;
        sum[i]=0;
        cnt[i]=0;
    }
    dfs(nd,-1);
    if(mn[nd]==0)
        return sum[nd]/2;
    else
        return (int)1e9;
}

int main(){
    fastIO;
    cin >> n;
    char f;
    for(int i = 1; i <= n ;i ++ ){
        cin >> f;
        has[i] = f - '0';
    }
    int u, v;
    for(int i = 1; i < n ; i ++ ){
        cin >> u >> v;
        T[u].push_back(v);
        T[v].push_back(u);
    }
    calc(1);
    int answ = (int)1e9;
    for(int i = 1; i <= n; i ++ ){
        answ=min(answ,calc(i));
    }
    if(answ==(int)1e9)
        cout << -1;
    else
        cout << answ;
    return 0;
}

Measured memory_bytes: 640
def start_process(length, num):

    print(ans)

def main():
    a = [int(input()) for i in range(5)]
    # b = int(input())
    # c = int(input())
    # d = int(input())
    # e = int(input())
    k = int(input())
    flg = 0
    for i in range(5):
        for j in range(i + 1, 5):
            if a[j] - a[i] > k:
                flg = 1
                break

    if flg == 0:
        print('Yay!')
    else:
        print(':(')

def kari():
    a = list(map(int, input().split()))
    a, b = map(int, input().split())

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int ans=0,l,r,i,d;
  cin >> l >> r >> d;
  for(i=l;i<=r;i++){
    if(i%d==0){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

int main()
{
    int n;
    int count = 0;
    cin >> n;
    for(int i = 0;i<n;i++){
        int a;
        cin >> a;
        if(isprime(a)) count++;
    }
    cout << count << endl;
   

    return 0;
}


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

using namespace std;

int main() {
    int N = 0;
    cin >> N;
    int x = 0;
    cin >> x;
    vector<int> A(N,0);
    for(int i = 0; i < N; i++) {
    cin >> A.at(i);
    }

    int ans = 0;
    sort(A.begin(),A.end());
    for (size_t i = 0; i < N; i++)
    {
       // cout << x << endl;
        x -= A.at(i);
        //cout << x << endl;
        if (x < 0){
            break;
        }
        //cout << 52345234 << endl;
        ans++;
        /* code */
        
    }
    if(x>0)ans--;
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
int main(void) {
 
  long long ans = 0;
  long long x = 0;
  long long y = 100;
  cin >> x;
  for (;y < x; ans++) {

    y = y+ y*0.01;
    
  }
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int a,b,c,k;
int main(){
scanf("%d%d%d",&a,&b,&c);
scanf("%d",&k);
printf("%d\n",(int)round(a+b+c+max(a,max(b,c))*(pow(2,k)-1)));
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if (B == 1) {
    cout << 0 << endl;
    return 0;
  }

  if (A > B) {
    cout << 1 << endl;
    return 0;
  }
  if ((B - A) % (A - 1) == 0) {
    cout << 1 + (B - A) / (A - 1) << endl;
  } else {
    cout << 1 + (B - A) / (A - 1) + 1 << endl;
  }
  return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<pair<pair<string, int>, int>> rest(n);
  for (int i = 0; i < n; i++)
  {
    string a;
    int b;
    cin >> a >> b;
    rest[i].first.first = a;
    rest[i].first.second = -b;
    rest[i].second = i;
  }

  sort(rest.begin(), rest.end());
  for (int i = 0; i < n; i++)
  {
    cout << rest[i].second + 1 << endl;
  }
}


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

using namespace std;

int main() {                                  
	string s, t;
	cin >> s >> t;
	map<char, int> a;
	map<char, int> b;    
	for (char i : s) ++a[i];
	for (char i : t) ++b[i];
	for (pair<char, int> i : a) {
	 	bool f = false;                
	 	 for (auto k = b.begin(); k != b.end(); ++k) {
	 	 	pair<char, int> j = *k;
	 		if (i.second == j.second) {
				j.second = -1;
				b.erase(k);
				f = true;
				break;
			}
		}
		if (!f) {
			cout << "No" << endl;
			return 0; 
		}
	}
	cout <<  "Yes" << endl;
}


Measured memory_bytes: 776
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include<algorithm>
#define pf printf
#define sf scanf

using namespace std;

bool isprime(int n){
	if(n < 2)return false;
	for(int i=2;i*i<=n;i++)
		if( n%i == 0)return false;
	return true;
}

int main()
{
    int n;
	bool arr[1000000] = {false};
	for(int i=0;i<1000000;i++){
		arr[i] = isprime(i);
	}
	while(cin >> n){
		int coun=0;
		for(int i=0;i<=n;i++){
			if(arr[i]==true)coun++;
		}
		printf("%d\n",coun);
	}
    return 0;
}

Measured memory_bytes: 2128
#include<stdio.h>

int main(int argc, char const* argv[])
{
    int W, H, x, y, r;
    scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

    if (x - r < 0 || y - r < 0 || x + r > W || y + r > H) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include<chrono>
#define ll long long
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
template<typename T>
struct RectangleSum {
	vector<vector<T>>imos;

	RectangleSum(vector<vector<T>>in) :imos(in.size(), vector<T>(in.size(), 0)) {
		for (int i = 1; i < in.size(); i++) {
			for (int j = 1; j < in.size(); j++) {
				imos[i][j] = in[i][j] + imos[i - 1][j] + imos[i][j - 1] - imos[i - 1][j - 1];
			}
		}
	}
	////xy平面を見て(p1,p2)が右上
	T GetRectangle(T p1, T p2, T q1, T q2) {
		return imos[p1][p2] - imos[q1 - 1][p2] - imos[p2][q2 - 1] + imos[q1 - 1][q2 - 1];
	}
};
int main() {
	cin >> N >> M >> Q;
	vector<vector<int>>t(N + 1, vector<int>(N + 1, 0));
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		t[L][R]++;
	}
	RectangleSum<int> rs(t);

	for (int x = 0; x < Q; x++) {
		int p, q;
		cin >> p >> q;
		cout << rs.GetRectangle(q, q, p, p) << endl;
	}
}

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

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  int left = 0, right = W, bottom = 0, top = H;
  for (int i = 0; i < N; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) left = max(left, x);
    else if (a == 2) right = min(right, x);
    else if (a == 3) bottom = max(bottom, y);
    else top = min(top, y);
  }
  if (right - left <= 0 || top - bottom <= 0) cout << 0 << endl;
  else cout << (right - left) * (top - bottom) << endl;
}

Measured memory_bytes: 256
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val H, N = in.nextInt
  val magics = Array.fill(N)((in.nextInt, in.nextInt))
  val dp = new Array[Int](H + 1)

  (1 to H).foreach{ i =>
    dp(i) = magics.map{ case (damage, mp) =>
      dp(Math.max(i - damage, 0)) + mp
    }.min
  }
  println(dp(H))
}

Measured memory_bytes: 108768
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
R,L,M,N = 0..25,[-1]*26,2,10
def F(d,n)
  n = D-d if n > D-d
  s,t = S[d],[0]*26
  i = R.max_by(M){|i| t[i] = n*C[i]*(d-L[i]) + s[i] }
  x = t[i[0]]
  i = n < 2 ? i[0] : i.max_by {|i|
    l,L[i] = L[i],d
    c = t[i] + (F(d+1,n-1)>>5)
    L[i] = l
    x < c ? x=c : c
  }
  (x<<5) + i
end
D.times { p 1+i=F(_1,N)&31; L[i]=_1 }

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, w;
    cin >> N >> w;
    vector<ll> W(N), V(N);
    for (int i = 0; i < N; i++) {
        cin >> W[i] >> V[i];
    }
    vector<vector<ll>> dp(N + 1, vector<ll>(100000 + 1, 1e9 + 1));
    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 100001; j++) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            if (j + V[i] < 100001) {
                dp[i + 1][j + V[i]] = min(dp[i + 1][j + V[i]], dp[i][j] + W[i]);
            }
        }
    }

    ll ans = 0;
    for (ll i = 0; i <= N; i++) {
        for (ll j = 0; j < 100001; j++) {
            if (dp[i][j] > w) continue;
            ans = max(ans, j);
        }
    }
    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 80256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MOD 1000000007
#define ll long long

ll K;
int H, W;
char p[1111][1111];

struct Mat{
	int A[2][2];
	void clear(){memset(A, 0, sizeof(A));}
	Mat operator *(const Mat a) const{
		static Mat t;
		t.clear();
		for(int i = 0; i < 2; i++)
			for(int k = 0; k < 2; k++)
				for(int j = 0; j < 2; j++)
					t.A[i][j] = (t.A[i][j] + 1ll * A[i][k] * a.A[k][j]) % MOD;
		return t;
	}
}y, ans;

int Pow(int a, ll b){
	int tmp = 1;
	for(; b; b >>= 1, a = 1ll * a * a % MOD)
		(b & 1) && (tmp = 1ll * tmp * a % MOD);
	return tmp;
}

Mat POW(Mat a, ll b){
	static Mat c;
	c.A[0][0] = c.A[1][1] = 1;
	c.A[0][1] = c.A[1][0] = 0;
	for(; b; b >>= 1, a = a * a)
		if(b & 1) c = c * a;
	return c;
}

int sum;
int okh, oks;
int nmh, nms;

int main(){
	scanf("%d %d %lld", &H, &W, &K);
	if(K <= 1) return !printf("1\n");
	for(int i = 1; i <= H; i++)
		scanf("%s", p[i] + 1);
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			if(p[i][j] == '#'){
				sum++;
				if(p[i + 1][j] == '#') nms++;
				if(p[i][j + 1] == '#') nmh++;
			}
		}
	}
	y.A[0][0] = sum;
	for(int i = 1; i <= H; i++)
		if(p[i][1] == '#' && p[i][W] == '#') okh++;
	for(int i = 1; i <= W; i++)
		if(p[1][i] == '#' && p[H][i] == '#') oks++;
	if(okh && oks) return !printf("1\n");
	if((!okh) && (!oks)) return !printf("%d\n", Pow(sum, K - 1));
	if(oks){
		y.A[0][1] = nms, y.A[1][1] = oks;
		ans = POW(y, K - 1);
	}
	else{
		y.A[0][1] = nmh, y.A[1][1] = okh;
		ans = POW(y, K - 1);
	}
	int as = (ans.A[0][0] - ans.A[0][1]) % MOD;
	(as < 0) && (as += MOD);
	return !printf("%d\n", as);
}

Measured memory_bytes: 1280
//AtCoder Regular Contest 065 C問題
#include <bits/stdc++.h>
using namespace std;

int main(){
	bool yes = true;
	bool out = false;
	char s[123456];
	for(int i=0;i<123456;i++){
		s[i] = 0;
	}
	scanf("%s", s);
	//int len = strlen(s);
	int see = 0;
	while(yes && !out){
		if(s[see] == 'd'){
			if(s[see+1] == 'r' && s[see+2] == 'e' && s[see+3] == 'a' && s[see+4] == 'm'){
				see += 5;
				if(s[see] == 'e' && s[see+1] == 'r' && s[see+2] != 'a'){
					see += 2;
				}
			}
			else yes = false; 
		}
		else if(s[see] == 'e'){
			if(s[see+1] == 'r' && s[see+2] == 'a' && s[see+3] == 's' && s[see+4] == 'e'){
				see += 5;
				if(s[see] == 'r'){
					see += 1;
				}
			}
			else yes = false;
		}
		else if(s[see] == 0){
			out = true;
		}
		else if(s[see] != 'd' && s[see] != 'e'&& s[see] != 0){
			yes = false;
		}
	}
	if(yes) printf("YES");
	else printf("NO");
}

Measured memory_bytes: 384
n = int(input())
s_lst = list(str(input()) for _ in range(n))
count_lst = [0, 0, 0, 0]

for i in range(n):
    consequence = s_lst[i]
    if consequence == 'AC':
        count_lst[0] += 1
    elif consequence == 'WA':
        count_lst[1] += 1
    elif consequence == 'TLE':
        count_lst[2] += 1
    else:
        count_lst[3] += 1

consequence_lst = ['AC x {}'.format(count_lst[0]), 'WA x {}'.format(count_lst[1]), 'TLE x {}'.format(count_lst[2]), 'RE x {}'.format(count_lst[3])]

for i in range(4):
    con = consequence_lst[i]
    print(con)

Measured memory_bytes: 16200
n, m = gets.split.map(&:to_i)
g = Array.new(n){[]}
m.times{
	a, b = gets.split.map{|i| i.to_i - 1}
	g[a] << b
	g[b] << a
}

puts [*1...n].permutation(n - 1).count{|order|
	order.unshift(0)
	ret = true
	order.each_cons(2){|a, b|
		unless g[a].include?(b)
			ret = false
			break
		end
	}
	ret
}

Measured memory_bytes: 2044
import java.util.Scanner;

public class Main {

    private static int i;

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N=sc.nextLong();
        long M=sc.nextLong();
        long K=sc.nextLong();
        int max = 0;
        long[] An = new long[(int)N+1];
        long[] Bn = new long[(int)M+1];
        for(int i=1; i<=N; i++){
            An[i]=sc.nextLong();
        }
        for(int i = 1; i <=M; i++){
            Bn[i] = sc.nextLong();
        }
        for(int i=1; i<=N; i++){
            An[i]+=An[i-1];
        }
        for(int i=1; i<=M; i++){
            Bn[i]+=Bn[i-1];
        }

        for(int i=0; i<=N; i++){    //上から
            if(An[i] <=K){
                long rest = K - An[i];
                int tmp = i;        //読めた本数
                int index = upperBound(Bn , rest);
                if(index == -1){
                    index = (int)M;
                }else{
                    index--;
                }
                tmp+=index;
                max = Math.max(max,tmp);
            }
            else{
                //
            }

        }
        lp(max);

    }
    public static void lp(Object o){
        System.out.println(o);
    }
    public static final int lowerBound(final long[] arr, final long value) {
        int low = 0;
        int high = arr.length;
        int mid;
        while (low < high) {
            mid = ((high - low) >>> 1) + low;    //(low + high) / 2 (オーバーフロー対策)
            if (arr[mid] < value) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        if(low<arr.length) {
            return low;
        }
        else {
            return -1;
        }
    }

    public static final int upperBound(final long[] arr, final long value) {
        int low = 0;
        int high = arr.length;
        int mid;
        while (low < high) {
            mid = ((high - low) >>> 1) + low;    //(low + high) / 2 (オーバーフロー対策)
            if (arr[mid] <= value) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        if(low<arr.length) {
            return low;
        }
        else {
            return -1;
        }
    }
}


Measured memory_bytes: 64120
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n;
char s[11],s2[11];
int main()
{
    cin >> n;
    for (int i = sqrt(n); i >= 1; -- i)
    {
        if (n % i == 0)
        {
            int i2 = n / i;
            //i = i > i2 ? i : i2;
            sprintf(s,"%d",i);
            sprintf(s2,"%d",i2);
            cout << max(strlen(s),strlen(s2)) << endl;
            //cout << endl << i << " " << i2;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
//   PIGMEISTER™   //

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mi map<ll,ll>
#define vi vector<ll>
#define si set<ll>
#define pi pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define test ll t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
//#define mod (ll)1000000007
#define mod (ll)998244353
#define MAX 500005
ll powah(ll, ll);

int main()
{
    jaldi;

    double n;
    cin >> n;
    cout << fixed << setprecision(10) << pow(n/3, 3);
    
    return 0;
}

ll powah(ll x, ll y) { 
    ll res = 1;
    x = x % mod;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % mod; 
        y = y>>1;
        x = (x*x) % mod; 
    } 
    return res; 
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"sort"
)

func fastGetInt(b []byte) int {
	neg := false
	if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n
	}
	return n
}
func hasValue(val int, sl []int) bool {
	for x := 0; x < len(sl); x++ {
		if sl[x] == val {
			return true
		}
	}
	return false
}

//========== Implement Algorithm =======================
func solution(X int, p []int) int {
	//fmt.Println(X, p)
	if !hasValue(X, p) {
		//fmt.Println("here")
		return X
	}
	sort.Ints(p)
	fullList := make([]int, (202))
	count := 0
	for i := -101; i < 101; i++ {

		if !hasValue(i, p) {
			fullList[count] = i
			count++
		}

	}
	retVal := fullList[0]

	smallest := int(math.Abs(float64(X) - float64(fullList[0])))
	//fmt.Println(retVal, smallest, fullList)
	for x := 1; x < len(fullList); x++ {
		if fullList[x] == 0 && x > 101 {
			break
		} else {
			if smallest > int(math.Abs(float64(X)-float64(fullList[x]))) {
				retVal = fullList[x]
				smallest = int(math.Abs(float64(X) - float64(fullList[x])))
			}
		}

	}
	if int(math.Abs(float64(X)-float64(101))) < smallest {
		retVal = 101
	}
	return retVal
}

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	//================== Variables used ====================
	var X, N, ret int
	//======================================================

	//============== Get return value from File ============
	if len(os.Args) >= 2 {

		file, err := os.Open(os.Args[1])
		if err != nil {
			log.Fatalf("failed opening file: %s", err)
		}
		scanner = bufio.NewScanner(file)
		defer file.Close()

	}
	scanner.Split(bufio.ScanWords)
	//======================= I/O ==========================
	scanner.Scan()
	X = fastGetInt(scanner.Bytes())
	scanner.Scan()
	N = fastGetInt(scanner.Bytes())
	if N == 0 {
		ret = X
	} else {
		p := make([]int, N)
		for x := 0; x < N; x++ {
			scanner.Scan()
			p[x] = fastGetInt(scanner.Bytes())
		}
		ret = solution(X, p)
	}

	//======================================================

	//==================== OUTPUT ==========================
	fmt.Println(ret)
}


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

using namespace std;
using ll = long long;

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define MP(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif


int main()
{
	int res = 0;
	int N;
	cin >> N;
	rep(i, N) {
		CIN(int, l);
		CIN(int, r);
		res += r - l + 1;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*Combination set*/
#define mod 1000000007
#define maxcomb 3000/*大きいものを求めるときはここを変える*/
vector<long long> fc(maxcomb+1);
vector<long long> ifc(maxcomb+1);
long long modpow(long long x,long long n){
    long long ans = 1;
    while(n > 0){
        if(n & 1) {
            ans = ans*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}
void Conb(){
    fc[0]= 1;
    ifc[0]=1;
    for(long long i=0;i<maxcomb;i++){
        fc[i+1] = fc[i]*(i+1)%mod;//n!(mod)
        ifc[i+1] = ifc[i]*modpow(i+1,mod-2)%mod;//k!^{M-2} (mod)
    }
}
unsigned long long Combination(long long L,long long R){
    unsigned long long up=1,ans;
    Conb();
    if(L==0&&R==0){
        return 1;
    }else if(L<R||L<0){
        return 0;
    }else{
        long long t = ifc[L-R]*ifc[R]%mod;
        ans = t*fc[L]%mod;
    }
    return ans;
}
/*Combination set ここまで*/

/*ここから*/
int main() {
    int N;
    cin >> N;
    int count = 0;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    vector<int> b(N,0);
    int ind = N/2;
    for(int i=N-1;i>=0;i--){
        if(ind<i+1){
            if(a[i]==1){
                b[i]=1;
                count++;
            }
        }else{
            int sum = 0;
            for(int j=i;j<N;j+=i+1){
                sum += b[j];
            }
            if(sum%2!=a[i]){
                b[i]=1;
                count++;
            }
        }
    }
    cout << count << endl;
    for(int i=0;i<N;i++){
        if(b[i]==1){
            cout << i+1;
            if(i!=N-1){
                cout << " ";
            }
        }
    }
    return 0;
}

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

int main() {
    long long x;
    cin>>x;
    int loop=1;
    for(int i=0;i<=1000;i++){
        for(int j=0;j<=1000;j++){
            if((pow(i,5)+pow(j,5))==x) {
                cout<<i<<" "<<-1*j<<endl;
                loop=0;
                break;
            }
            else if((pow(i,5)-pow(j,5))==x) {
                cout<<i<<" "<<j<<endl;
                loop=0;
                break;
            }
        }
        if(loop==0) break;
    }
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define For(i, j, k) for(int i = j; i <= k; ++i)
using namespace std;

inline void File() {
#ifndef ONLINE_JUDGE
	freopen("AGC002E.in", "r", stdin);
	freopen("AGC002E.out", "w", stdout);
#endif
}

const int N = 1e5 + 10;
int A[N], n;

inline bool cmp(int a, int b) { return a > b; }

int main() {
	scanf("%d", &n);
	For(i, 1, n) scanf("%d", &A[i]);
	sort(A + 1, A + 1 + n, cmp);
	int tmp = 1;
	while(A[tmp] >= tmp) ++tmp; --tmp;
	int ans = (A[tmp] - tmp) & 1, res = 0;
	For(i, tmp + 1, n) {
		if(A[i] == tmp) res++;
		else break;
	}
	ans |= (res & 1);
	printf("%s\n", ans ? "First" : "Second");
	return 0;
}

Measured memory_bytes: 640