akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

ll abs_(ll n) {
    if (n >= 0) {
        return n;
    }
    return -n;
}

int main() {
    int N;
    cin >> N;
    ll lines[N];
    rep(i, N) {
        cin >> lines[i];
    }

    int result = 0;
    for (int i = 0; i < N-2; i++) {
        ll l1 = lines[i];
        for (int j = i+1; j < N-1; j++) {
            ll l2 = lines[j];
            if (l1 == l2) continue;
            for (int k = j+1; k < N; k++) {
                ll l3 = lines[k];
                if (l1 == l3) continue;
                if (l2 == l3) continue;
                if (abs_(l2 - l3) < l1 && l1 < l2 + l3) {
                    result++;
                }
            }
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3188
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN, datK) = readLine.split(" ").map(_.toInt)
    val datA = readLine.split(" ").map(_.toInt)

    def recScoring(idx: Int) : Unit = {
      if (idx >= datA.length) return
      if (datA(idx) > datA(idx - datK)) println("Yes")
      else println("No")
      recScoring(idx + 1)
    }
    recScoring(datK)
  }
}


Measured memory_bytes: 86480
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main(){
	int a,b,c,la,lb,lc;
  int nxt = 0;
  std::string sa,sb,sc;
  cin >> sa >> sb >> sc;
  la = sa.length();
  lb = sb.length();
  lc = sc.length();
  a=b=c=0;
  while(1){
    char t;
    switch(nxt){
      case 0:
      if(a==la){
        cout << "A" << "\n";
        return 0;
      }
      t = sa[a++];
      break;
      case 1:
      if(b==lb){
        cout << "B" << "\n";
        return 0;
      }
      t = sb[b++];
      break;
      case 2:
      if(c==lc){
        cout << "C" << "\n";
        return 0;
      }
      t = sc[c++];
    }
    switch (t) {
      case 'a':
      nxt = 0;
      break;
      case 'b':
      nxt = 1;
      break;
      case 'c':
      nxt = 2;
      break;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353 
#define pb push_back
#define mb make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int maxw = 1e9+7;
const int maxv = 1e5+7;
int main(){
	IOS;
	int n,w; cin >> n >> w;
	int W[n],val[n];
	for(int i=0;i<n;i++)
		cin >> W[i] >> val[i];
	int dp[n+1][maxv];
	for(int i=0;i<maxv;i++)
		dp[0][i] = maxw;
	dp[0][0] = 0 ; 
	for(int i = 1;i<=n;i++){
		for(int j = 0 ; j < maxv ; j++){
			if(j<val[i-1])
				dp[i][j] = dp[i-1][j];
			else
				dp[i][j] = min(dp[i-1][j],dp[i-1][j-val[i-1]] + W[i-1]);
		}
	}
	for(int j = maxv-1;j>=0;j--){
		if(dp[n][j] <= w){
			cout << j << endl;
			break;
		}
	}

	return 0;
}




Measured memory_bytes: 39680
#include<stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll cost[110][110];
ll dddd[110][110];

void waasharuhuroido(ll n){
	rep(i,0,n)rep(j,0,n)dddd[i][j]=i==j?0:cost[i][j]?cost[i][j]:INF;
	rep(k,0,n)rep(i,0,n)rep(j,0,n)dddd[i][j]=min(dddd[i][j],dddd[i][k]+dddd[k][j]);
}

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	rep(i,0,m){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		a--;b--;
		cost[a][b]=cost[b][a]=c;
	}
	waasharuhuroido(n);
	int ans=0;
	rep(i,0,n)rep(j,i+1,n)if(cost[i][j]){
		int f=1;
		rep(ii,0,n)rep(jj,0,n)if(dddd[ii][i]+cost[i][j]+dddd[j][jj]==dddd[ii][jj])f=0;
		ans+=f;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
from math import ceil

X = int(input())

if X <= 6:
    print(1)
    exit(0)

r = X % 11

# 11, 22, 33, ...
if r == 0:
    print((X // 11) * 2)
elif r <= 6:
    print(ceil(X / 11) * 2 - 1)
else:
    print(ceil(X / 11) * 2)

Measured memory_bytes: 38384
#include<stdio.h>
main()
{
    int x, a, b, c, d;
    scanf("%d %d %d", &x, &a, &b);
    c=a-x;
    if(c<0)
        c=c*-1;
    d=b-x;
    if(d<0)
        d=d*-1;
    if(c<d)
        printf("A");
    else
        printf("B");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

char c[1000][1060];
stack<int> depth;
int countDots(char* const c){
  for(int count=0;c[count]!='\0';count++){
    if(c[count]!='.')
      return count;
  }
  return 0;
}

int main(){ _;
  int n;
  while(cin>>n,n!=0){
    REP(i,n) cin>>c[i];
    REP(i,n){
      unsigned int dots=countDots(c[i]);
      if(dots==0)continue;
      REP(j,dots-1)c[i][j]=' ';
      c[i][dots-1]='+';
      if(depth.size()<dots){
	depth.push(i);
      }else{
	while(depth.size()>dots) depth.pop();
	for(int j=depth.top()+1;j<i;j++){
	  c[j][dots-1]='|';
	}
	depth.pop();
	depth.push(i);
      }
    }
    REP(i,n)
      cout<<c[i]<<endl;
  }
}

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

const int INF = 1000000005;

int main(){
    int h, n;
    cin >> h >> n;
    vector<int> dp(h+1, INF);
    dp[0] = 0;
    for(int i = 1; i <= n; i++){
        int a, b;
        cin >> a >> b;
        for(int j = 0; j <= h; j++){
            int nj = min(j + a, h);
            dp[nj] = min(dp[nj], dp[j] + b);
        }
    }
    cout << dp[h] << endl;
}

Measured memory_bytes: 3620
#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 INF (1ll<<60)
#define mod 1000000007
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}

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

    vector<ll> ans;
    while(n>=0){
        ans.push_back(n%26);
        n/=26;
        n--;
    }

    ll num=ans.size();
    for(ll i=num-1;i>=0;i--){
        cout<<(char)('a'+ans[i]);
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3580
package main

import (
	"fmt"
)
func is_in3(x int) bool{
	for{
		if x%10 == 3{
			return true
		}else if  x/10 == 0{
			break
		}else{
			x /= 10
		}
	}
	return false
}

func main(){
	var x int
	fmt.Scan(&x)
	for i:=1; i<=x; i++{
		if is_in3(i) || i % 3 == 0{
			fmt.Printf(" %d", i)
		}
	}
	fmt.Print("\n")
}


Measured memory_bytes: 1136
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

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

    vector< vector<int> > v(n);
    rep(i,n) {
        v[i].resize(n);

        rep(j,n) cin >> v[i][j];
    }

    rep(i,n) {
        REP(j,1,n) {
            v[i][j] += v[i][j-1];
        }
    }

    REP(i,1,n) {
        rep(j,n) {
            v[i][j] += v[i-1][j];
        }
    }

    int ans = -INF;
    rep(i,n) {
        rep(j,n) {
            rep(k,i+1) {
                rep(l,j+1) {
                    int ret;
                    if(k > 0 && l > 0) {
                        ret = v[i][j] - v[k-1][j] - v[i][l-1] + v[k-1][l-1];
                    } else if(k > 0) {
                        ret = v[i][j] - v[k-1][j];
                    } else if(l > 0) {
                        ret = v[i][j] - v[i][l-1];
                    } else {
                        ret = v[i][j];
                    }

                    ans = max(ans,ret);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
//#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
//#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;


void P(auto a){
    REP(i,a.size()){
        if(i){
            cout << " ";
        }
        cout << a[i];
    }
    cout << "\n";
}


signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int q;
    cin >> n >> q;
    vector<queue<int>> a(n);
    REP(i,q){
        int tmp;
        cin >> tmp;
        switch (tmp)
        {
        case 0:
            int t,x;
            cin >> t >> x;
            a[t].push(x);
            break;
        case 1:
            cin >> t;
            if(a[t].size()!=0) print(a[t].front());
            break;
        default:
            cin >> t;
            if(a[t].size()!=0) a[t].pop();
            break;
        }
    }

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 4292
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define tri pair<pll, ll>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<pll, ll> > 
#define mll map<ll, ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define all(v)  (v).begin(), (v).end()
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
// #define MOD 998244353
#define endl "\n"
#define INF (ll)1e18
#define s(v) (ll)v.size()
#define e(v) v.empty()
#define bscount(x) __builtin_popcountll(x)
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
// using namespace __gnu_pbds;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll cpow(ll a, ll b, ll M){ll ans = 1;while(b){if(b&1) ans = ans*a%M; b/=2;a=a*a%M;}return ans;}
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}
ll modify(ll n){ll res = n;res%=MOD;res+=MOD;res%=MOD;return res;}
ll fexp(ll a, ll b) {return cpow(a, b, MOD);}
ll cinv(ll a, ll p){return cpow(a, p-2, p);} 
ll inverse(ll a)    {return cinv(a, MOD);}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("../input.txt", "r", stdin);
    //     freopen("../output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
        ll n;
        cin>>n;
        string str;
        vl a(4);
        rep(i, n){
            cin>>str;
            if(str[0] == 'A')   a[0]++;
            else if(str[0] == 'W')  a[1]++;
            else if(str[0] == 'T')  a[2]++;
            else a[3]++;
        }
        cout<<"AC x "<<a[0]<<endl;
        cout<<"WA x "<<a[1]<<endl;
        cout<<"TLE x "<<a[2]<<endl;
        cout<<"RE x "<<a[3]<<endl; 
    }
}

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

#include <cstdlib>
#include <iostream>
#include <istream>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>

using lint = long long;
using namespace std;

int main() {
    lint N, K;

    std::cin >> N >> K;
    std::vector<lint> res(N, 0);

    lint d = 0;

    for (lint i = 0; i < K; i++) {
        std::cin >> d;
        lint temp = 0;
        for (lint j = 0; j < d; j++) {
            std::cin >> temp;
            res[temp - 1]++;
        }
    }

    lint ans = 0;

    for (lint i = 0; i < N; i++) {
        if (res[i] == 0) {
            ans++;
        }
    }

    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 3252
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>


using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

class AMultipleOf2AndN {
public:
void solve(std::istream& cin, std::ostream& cout) {
    int a;
    int ans = 0;
    //string ans = "";
    cin >> a;
    if (a%2==0){
        ans = a;
    }else{
        ans = a*2;
    }

    cout << ans << endl;
}
};


int main() {
	AMultipleOf2AndN solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int main()
{
    int n;
    int size;
    int sum=0;
    
    cin>>n>>size;
    int arr[size];
    for (int i=0;i<size;i++){
        cin>>arr[i];
        sum=sum+arr[i];
    }
    if(sum>n)
    cout<<"-1"<<endl;
    else
    cout <<n-sum<<endl;

    return 0;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;

static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

string hex2bin(const char hex[256]){
  int parts[8];
  sscanf(hex,"%2x%2x%2x%2x",
         parts,parts+1,parts+2,parts+3);

  string res = "";
  for(int i = 0; i < 4; i++){
    string tmp = "";
    for(int j = 0; j < 8; j++){
      tmp.push_back((parts[i] % 2) ? '1' : '0');
      parts[i] /= 2;
    }
    reverse(tmp.begin(),tmp.end());
    res += tmp;
  }
  return res;
}

string bin2dec(const string& bin){
  int sign = (bin[0] == '1' ?  -1 : +1);

  int integers = 0;;
  int int_mul = 1;
  for(int i = 1 + 24 - 1,j = 0; i >= 1; i--,j++){
    if(bin[i] == '1'){
      integers += int_mul;
    }
    int_mul *= 2;
  }

  double dec_mul = 0.5;
  double decimals = 0.0;
  for(int i = 25; i < 32; i++){
    if(bin[i] == '1'){
      decimals += dec_mul;
    }
    dec_mul *= 0.5;
  }

  char tmp_decimals[10];
  sprintf(tmp_decimals,"%.10lf",decimals);
  int r_pos = 10;
  int l_pos = 1;
  for(int i = 10; i >= 0; i--){
    if(tmp_decimals[i] != '0'){
      r_pos = i;
      break;
    }
    r_pos = i;
  }
  
  string res = "";
  stringstream ss;
  res += (sign < 0 ? "-" : "");
  ss << integers;
  res += ss.str();
  if(l_pos == r_pos) r_pos++;
  for(int i = l_pos; i <= r_pos; i++){
    res.push_back(tmp_decimals[i]);
  }
  return res;
}

int main(){
  int N;
  while(~scanf("%d",&N)){
    for(int i = 0; i < N; i++){
      char hex[256];
      scanf("%s",hex);
      string bin = hex2bin(hex);
      cout << bin2dec(bin) << endl;
    }
  }
}

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

int main()
{
  int a, b, c, d, i, j;
  cin >> a >> b >> c >> d;

  for (i = 0; i < 100; i++)
  {
    c -= b;

    if (c <= 0)
      break;
  }
  for (j = 0; j < 100; j++)
  {
    a -= d;
    if (a <= 0)
      break;
  }
  if (i <= j)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

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

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define gcd(x,y) __gcd((x),(y))

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const ld EPS = 1e-9, PI = acos(-1.);
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e4+5;

int n, a[N], b[N];
ll da[N], db[N];

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);

  for (int i = 0; i < n; i++) {
    ll d = b[i]-a[i];
    if (d > 0) {
      if (d%2 == 0) da[i] = d/2;
      else da[i] = (d+1)/2, db[i] = 1;
    } else {
      db[i] = -d;
    }
  }

  ll s = 0;
  for (int i = 0; i < n; i++) s += da[i] - db[i];
  if (s < 0) printf("No\n");
  else printf("Yes\n");

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include<algorithm>
using namespace std;

int main(){
	int n;
	string s;
	cin >> n >> s;
	int e1 = 0, w1 = 0;
	for (int i = 1;i < n;i++) {
		if (s[i] == 'E') e1++;
	}
	for (int i = 0;i < n - 1;i++) {
		if (s[i] == 'W') w1++;
	}
	int ans = 100000000;
	ans = min(ans, e1);
	int now = e1;
	for (int i = 1;i < n;i++) {
		if (s[i - 1] == 'W'  && s[i] == 'W')now++;
		else if (s[i - 1] == 'E' && s[i] == 'E') now--;
		ans = min(ans, now);
	}
	ans = min(ans, w1);
	cout << ans << endl;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>vec;
vector<ll>v;
int main(){
  ll x,y,z,k;
  ll a[1009],b[1009],c[1009];
  cin>>x>>y>>z>>k;
  for(int i=0;i<x;i++){
    cin>>a[i];
  }
  for(int i=0;i<y;i++){
    cin>>b[i];
  }
  for(int i=0;i<z;i++){
    cin>>c[i];
  }
  for(int i=0;i<x;i++){
    for(int j=0;j<y;j++){
      vec.push_back(a[i]+b[j]);
    }
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  sort(c,c+z);
  reverse(c,c+z);
  ll cnt=0;
  for(int i=0;i<z;i++){
    for(int j=0;j<min((ll)vec.size(),k);j++){
      v.push_back(c[i]+vec[j]);
    }
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  for(int i=0;i<k;i++){
    cout<<v[i]<<endl;
  }
  return(0);
}


Measured memory_bytes: 43236
import java.util.Scanner;

class Main {
	public static int a, b;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNextInt()){
			a = cin.nextInt();
			b = cin.nextInt();
			solve();
		}
	}
	
	public static void solve() {
		a += b;
		int ans = 1;
		while(a / 10 > 0){
			a /= 10;
			ans++;
		}
		System.out.println(ans);
	}
}

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

int main()
{
  int n, c[4]={0};
  string judge[4] = {"AC", "WA", "TLE", "RE"};
  cin >> n;
  for(int i = 0; i < n; i++)
  {
    string s;
    cin >> s;
    for(int j=0; j<4; j++)
    {
      if(judge[j] == s)
      {
        c[j]++;
        break;
      }
    }
  }
  
  for(int i=0; i<4; i++)
    cout << judge[i] << " x " << c[i] << endl;
  
  return 0;
}

Measured memory_bytes: 3604
n = int(input())
d = [list(map(int,input().split())) for _ in range(n)]
cnt = ""
for x,y in d:
    if x==y:
        cnt+="1"
    else:
        cnt+="0"
        
cnt = cnt.split("0")
ans = 0
for s in cnt:
    ans = max(ans,len(s))
print("Yes" if ans>=3 else "No")

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

int main() {
    string s;
    long long k;
    cin >> s >> k;
    int a, b = INT_MAX;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != '1') {
            a = s[i] - '0';
            b = i + 1;
            break;
        }
    }
    if (k < b) cout << 1 << endl; 
    else cout << a << endl;
}

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

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

  for (int i = 0; i < m; ++i) {
    int ans = 0, p, y, n;
    cin >> p >> y >> n;

    for (int j = 0; j < n; ++j) {
      int tmp, in, cost;
      double rate;
      cin >> in >> rate >> cost;
      if (in == 0) {
	int pp = p, ii = 0;
	for (int k = 0; k < y; ++k) {
	  ii +=  static_cast<int>(pp * rate);
	  pp -= cost;
	}
	tmp = pp + ii;
      } else {
	int pp = p;
	for (int k = 0; k < y; ++k)
	  pp = static_cast<int>(pp * (1.0 + rate)) - cost;
	tmp = pp;
      }
      ans = max(ans, tmp);
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 0
let () =
	let o = read_line () in
	let e = read_line () in
	let o_len = String.length o in
	let e_len = String.length e in
	for i = 0 to e_len - 1 do
		print_char o.[i];
		print_char e.[i]
	done;
	if o_len > e_len then begin
		print_char o.[o_len - 1];
		print_newline ()
	end else
		print_newline ()


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

int main(){
    int N=0,S=0,E=0,W=0;
    string cadena;
    cin>>cadena;
    for(int i=0 ; i< cadena.size(); i++){
        if(cadena[i]=='N')N++;
        else if(cadena[i]=='S')S++;
        else if(cadena[i]=='E')E++;
        else if(cadena[i]=='W')W++;
    }
    if(((N>0 && S>0)||(N==0 && S==0)) && ((E>0 && W>0)||(E==0 && W==0))) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define vi vector<ll>
#define all(v) v.begin(), v.end()

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

	ll n = 0;
	cin >> n;
	vi x(n), y(n), tim(n);
	rep(i, n)	
		cin >> tim[i] >> x[i] >> y[i];

	ll dis = 0;
	string ans;
	
	rep(i, n) {
		ll xx = 0, yy = 0;
		dis = abs(x[i] - xx) + abs(y[i] - yy);
		tim[i] -= dis;
		if(tim[i] < 0 || (tim[i] % 2) != 0) {
			ans = "No";
			break;
		}
		else
			ans = "Yes";
	}
	cout << ans << endl;
		
	//cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i=(n);i>=0;i--)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<ll>>;
template<typename T=ll,typename U=ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;

void a(){
    string s; cin >> s;
    if(s.find("A")==string::npos){
        cout << "No";
    }else if(s.find("B")==string::npos){
        cout << "No";
    }else{
        cout << "Yes";
    }
}


void b(){
    ll n,a,b; cin >> n >> a >> b;
    ll amari = n%(a+b);
    ll count = n/(a+b);
    ll counta=0;
    ll countb=0;
    if(amari<=a){
        counta = amari;  
    }else{
        counta = a;
        countb = amari-a;
    }
    counta += a*count;
    countb += b*count;
    cout << counta;

}

void c(){
    ll a,b; cin >> a >> b;
    ll n = 1000;
    ll ans =0;
    bool f=false;
    rep(i,n+1){
        if(floor(i*0.08) == a&&floor(i*0.1)==b){
            ans=i;
            f=true;
            break;
        }
    }
    cout << (f?ans:-1);

}

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


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func main() {
	var n, t0, x0, y0, t1, x1, y1 int
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&t1, &x1, &y1)
		if d, t := abs(x1-x0) + abs(y1-y0), t1-t0;
		d > t || d%2 != t%2 {
			fmt.Println("No")
			return
		}
		t0 = t1; x0 = x1; y0 = y1
	}

	fmt.Println("Yes")
}

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

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            String s;
            s = Console.ReadLine();

            char[] cs = s.ToCharArray();

            cs[3] = '8';

            Console.WriteLine(cs);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  string S,T;
  cin >> S >> T;
  ll N = S.size();
  vector<set<int>> se(26);
  rep(i,N){
    se[S[i]-'a'].insert(i);
  }
  rep(i,26){
    se[i].insert(inf);
  }
  ll pos = 0;
  ll cnt = 0;
  rep(i,T.size()){
    int temp = *se[T[i]-'a'].lower_bound(pos);
    if(temp != inf){
      pos = temp;
    }else{
      cnt++;
      pos = 0;
      pos = *se[T[i]-'a'].begin();
      if(pos == inf){
        cout << -1 << endl;
        return 0;
      }
    }
    pos++;
  }
  cout << cnt*N+pos << endl;
  return 0;
}


Measured memory_bytes: 5120
#include <stdio.h>

int main(){
  int r, c;
  scanf("%d %d", &r, &c);

  /*表生成と初期化*/
  int table[r + 1][c + 1];

  for(int row = 0; row <= r; row++){
	for(int column = 0; column <= c; column++){
	  table[row][column] = 0;
	}
  }

  /*値の読み込み*/
  for(int row = 0; row < r; row++){
	for(int column = 0; column < c; column++){
	  scanf("%d", &table[row][column]);
	}
  }

  /*行の集計*/
  for(int row = 0; row < r; row++){
	for(int column = 0; column < c; column++){
	  table[row][c] += table[row][column];
	}
  }

  /*列の集計*/
  for(int column = 0; column <= c ; column++){
	for(int row = 0; row < r; row++){
	  table[r][column] += table[row][column];
	}
  }

  /*表の表示*/
  for(int row = 0; row <= r; row++){
	for(int column = 0; column <= c; column++){
	  printf("%d",table[row][column]);
	  if(column != c){printf(" ");}
	}
	printf("\n");
  }

  return 0;
}


Measured memory_bytes: 2052
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	long long ans=1;
	for(int i=2;i<=n;i++)
	{
		ans*=i;
		ans%=1000000007;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        if (!(a[i] & 1)) {
            if (!(a[i] % 6 == 0 || a[i] % 10 == 0)) {
                cout << "DENIED" << endl;
                return  0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
void printArray(const int *A, int N){
    for(int i=0; i<N-1; i++){
        cout << A[i] << " ";
    }
    cout << A[N-1] << endl;
}

void insertionSort(int *A, int N){
    int v;
    for(int i=1; i<N; i++){
        v = A[i];
        int j = i-1;
        while( j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        printArray(A, N);
    }
}

int main(){
    int x;
    cin >> x;
    int* A = new int[x];
    for(int i=0; i<x; i++){
        cin >> A[i];
    }
    printArray(A, x);
    insertionSort(A, x);
    delete A;
}


Measured memory_bytes: 3092
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        A[i] -= x;
    }
    sort(A.begin(), A.end(), greater<int>());

    int res = 0;
    for (auto x : A) {
        res += max(0, x);
    }
    cout << res << "\n";

    return 0;
}

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

int main() {
    char a, b;
    cin >> a >> b;
    if (a == 'H'){
        cout << b << endl;
    }else if (b == 'H'){
        cout << 'D' << endl;
    }else{
        cout << 'H' << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define ll long long
int main()
{
    ll n,x,l,sum=0,count=1;
    scanf("%lld%lld",&n,&x);
    while(n--){
            scanf("%lld",&l);
        sum=sum+l;
    if(sum<=x){
        count++;
    }
    }
    printf("%lld\n",count);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

namespace _{struct _{_(){ // initialize
  cin.tie(0); ios::sync_with_stdio(false);
}}_;}
template <typename T, size_t size>
inline size_t len(const T (&)[size]) { return size; }
#define println(s) cout << s << '\n';
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()

#define MAX_N 100001
#define WHITE 0
#define BLACK 1
int n;
int table[MAX_N];

// DEBUG

void dump(int f) {
  cout << "f: " << f << '\n';
  rep(i, n) {
    cout << (table[i]==WHITE?'.':table[i]==BLACK?'#':' ');
  }
  cout << '\n';
}


int main() {
  while (true) {
    cin >> n;
    if (n == 0) break;
    rep(i, n) table[i] = -1;
    //
    int f = 0; // f <-?????????-> ?

    rep(i, n) {
      // 0 -> ???, 1 -> ???
      int x; cin >> x;
      // ?\???°
      // if ((i+1) % 2 == 1)
      if (i % 2 == 0) {
        table[i] = x;
        // ??£?¶????????????????????¨????
        if (i != 0 && table[i-1] != x) f = i;
      }
      // ??¶??°
      else {
        int t = table[i-1]; // ????????????
        // ????????¨????????????????????????
        if (t == x) table[i] = x;
        else {
          // .#   or   #.
          // ????????????(t)??¨??????(??£?¶?)??§???????????????????????????
          // f??????i-1?????§???????????????
          for (int j=f; j<=i; j++) table[j] = x;
          // ????????????????´¢
          for (int j=f-1; f>0; j--) {
            if (table[j] != x) {
              f = j;
              break;
            }
            if (j <= 1) {
              f = 0;
              break;
            }
          }
        }
      }
      //dump(f);
    }
    int count = 0;
    rep(i, n) {
      if (table[i] == WHITE) count++;
    }
    cout << count << '\n';
  }
  return 0;
}

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

int main()
{
	int n;
	cin>>n;
	
	int c=0;
	for(int i=1;i<=n;i++)
	{
		int num;
		cin>>num;
		if((i&1) && (num&1))
		  c++;
	}
	cout<<c<<endl;
	
	return 0;
}

Measured memory_bytes: 3576
#coding: utf-8
N = int(raw_input())
S = raw_input()

n = 0
m = 0
for s in S:
	if s == '(':
		n += 1
	else:
		n -= 1
	m = min(n, m)

l = abs(m)
r = n + l

S = '(' * l + S + ')' * r
print S

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

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

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

int main() {
  int N;
  cin >> N;
  cout << N * N * N << endl;
};


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n], b[n], c[n], ans = 0;
	REP(i,n){
		c[i] = 0;
	}
	REP(i,n){
		cin >> a[i];
		b[i] = a[i];
		while(b[i] % 2 == 0){
			c[i]++;
			b[i] /= 2;
		}
	}

	REP(i,n){
		ans += c[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;             
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;

void solve () {
	int n, m;
	cin >> n >> m;
	cout << (n - 1) * n / 2 + (m - 1) * m / 2; 
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
//------------------------------------------------------------
ll s,w,ans=0;

void solve() {
  cin>>s>>w;

  if(s>w) print("safe");
  else print("unsafe");

  return;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {

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

    if (a == b) {
      System.out.println(c);
    }
    if (b == c) {
      System.out.println(a);
    }
    if (c == a) {
      System.out.println(b);
    }
  }

}


Measured memory_bytes: 21844
N,W = map(int,input().split())
L = list(list(map(int,input().split())) for i in range(N))

dp = [[0 for x in range(W+1)] for y in range(N+1)]

for item in range(N) :
    weight_i,value_i = L[item]
    for weight in range(W+1) :
        if weight - weight_i >= 0 :
            dp[item+1][weight] = max(dp[item][weight], dp[item][weight - weight_i] + value_i)
        else :
            dp[item+1][weight] = dp[item][weight]
ans = dp[N][W]

print(ans)


Measured memory_bytes: 171656
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

now = 0
route = []
seen = [False]*N
while True:
    route.append(now)
    seen[now] = True
    to = A[now] - 1
    if seen[to]:
        break
    else:
        now = to
loop_start = route.index(to)
loop_size = len(route) - loop_start

n_for_loop = min(K, loop_start)
K -= n_for_loop
n_in_loop = K%loop_size

print(route[n_for_loop + n_in_loop] + 1)

Measured memory_bytes: 32324
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
	IOS;
	int n; cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<s.length()-2;i++){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i, a, b, k;

    scanf("%d%d%d", &a, &b, &k);

    for (i=a; i<=b; i++) {
        if (i<=a+(k-1) || i>=b-(k-1))
            printf("%d\n", i);
    }

    return 0;
}

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

int main() {
  int n, s = 0;
  cin >> n;
  vector<int> v(n);
  for(int i = 0;i < n;i++) cin >> v[i];
  for(int i = 0;i < n-2;i++) {
    if((v[i] - v[i+1])*(v[i+1] - v[i+2]) > 0) s++;
  }
  cout << s << endl;
}

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;

int n;

int main(){
    cin>>n;
    if(n==3){
        cout<<"2 3 25\n";
        return 0;
    }
    int a=min(n/2-1,2500);
    int b=n-2*a,c=b%3;
    b-=c;
    rep(i,a){
        if(i)cout<<" ";
        cout<<i*12+3<<" "<<i*12+9;
    }
    rep(i,b){
        cout<<" "<<i*2+2;
    }
    if(c==0)cout<<endl;
    if(c==1)cout<<" 30000\n";
    if(c==2)cout<<" 29996 29998\n";
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
int get(int n)
{
	  int count=0;
	  while(n>0)
	  {
	  	   count++;
	  	   n/=10;
	  }
	  return count;
}
signed main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	 int n;
	 cin>>n;
	 int res=1e9;
	 for(int i=1;i<=sqrt(n);i++)
	 {
	 	    if(n%i==0)
	 	    {
	 	    	  res=min(res,max(get(i),get(n/i)));
	 	    }
	 }
	 cout<<res<<endl;
	 time();
	 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int w, h, n;
char map[1024][1024];
// 各点到当前工厂的距离
int d[1024][1024];
const int direction[4][2] = {
	{ -1, 0 },
	{ 1, 0 },
	{ 0, -1 },
	{ 0, 1 },
};

int factory[16][2];
typedef pair<int, int> P;



//************************************
// Method:    bfs
// FullName:  bfs
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const int & sx 起点x
// Parameter: const int & sy 起点y
// Parameter: const int & gx 终点x
// Parameter: const int & gy 终点y
//************************************
int bfs(const int& sx, const int& sy, const int& gx, const int& gy)
{
	//memset(d, -1, sizeof(d));
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			d[j][i] = -1;
		}
	}
	queue<P> que;
	que.push(P(sx, sy));
	d[sx][sy] = 0;
	while (que.size())
	{
		const P p = que.front(); que.pop();
		// 如果是终点就结束
		if (p.first == gx && p.second == gy)
		{
			break;
		}

		// 四方向漫游
		for (int i = 0; i < 4; ++i)
		{
			int nx = p.first + direction[i][0];
			int ny = p.second + direction[i][1];
			// 是否可以移动，并且该点没有访问过
			if (0 <= nx && nx < w && 0 <= ny && ny < h && map[nx][ny] != 'X' && d[nx][ny] == -1)
			{
				que.push(P(nx, ny));
				d[nx][ny] = d[p.first][p.second] + 1;
			}
		}
	}

	return d[gx][gy];
}

///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{

	cin >> h >> w >> n;
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			cin >> map[j][i];
		}
	}

	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			if (map[j][i] == 'S')
			{
				factory[0][0] = j;
				factory[0][1] = i;
				map[j][i] = '.';
			}
			else if (isdigit(map[j][i]))
			{
				int index = map[j][i] - '0';
				factory[index][0] = j;
				factory[index][1] = i;
			}
		}
	}

	int step = 0;
	for (int i = 0; i < n; ++i)
	{
		// 按顺序吃遍中华
		step += bfs(factory[i][0], factory[i][1], factory[i + 1][0], factory[i + 1][1]);
	}
	
	cout << step << endl;

	return 0;
}


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

typedef long long i64;
const int NMAX = 200010;
const int LG = 60;
int val[NMAX];
int poz[NMAX];
int jump[NMAX];
i64 up[LG][NMAX];
/// unde ajung si cate elemente am in rucsac in 2^k pasi
int n;
vector <int> v;

int main()
{
	i64 k;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> k;
	k *= n;

	fill(poz, poz + NMAX, -1);
	fill(jump, jump + NMAX, -1);

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

	for (int i = 0; i < 2 * n; i++) {
		if (poz[val[i % n]] != -1)
			jump[poz[val[i % n]]] = i % n;
		poz[val[i % n]] = i % n;
	}


	for (int i = 0; i < n; i++) {
		assert(jump[i] != -1);
		if (jump[i] <= i)
			jump[i] += n;
		up[0][i] = jump[i] - i + 1;
	}

	i64 inf = 1e18;

	for (int j = 1; j < LG; j++) {
		for (int i = 0; i < n; i++) {
			i64 middle = i + up[j - 1][i];
			i64 add = up[j - 1][i] + up[j - 1][middle % n];
			add = min(add, inf);
			up[j][i] = add;
		}
	}

	i64 pact = 0;
	for (int i = 59; i >= 0; i--)
		if (pact + up[i][pact % n] <= k)
			pact += up[i][pact % n];

	fill(poz, poz + NMAX, -1);
	while (pact != k) {
		int a = val[pact % n];
		pact++;
		if (poz[a] != -1) {
			while (poz[a] != -1)
				poz[v.back()] = -1, v.pop_back();
		}
		else
			v.push_back(a), poz[a] = 1;
	}

	for (auto i : v)
		cout << i << ' ';
	cout << '\n';
	return 0;
}

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

int main() {
  int n, x;
  cin >> n;
  x = n - n * 2 / 27;
  if (x * 27 / 25 <= n) {
    cout << x << endl;
  } else {
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
   public static void main(String[] main) throws Exception{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer st = new StringTokenizer(br.readLine());
      PrintWriter out = new PrintWriter(System.out);
      long n = Long.parseLong(st.nextToken());
      double m = Double.parseDouble(st.nextToken());
      long res = Math.round(m*100);
      long ans = res*n;
      out.println(ans/100);
      out.close();
   }
}


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

typedef long long ll;

int main () {
	char S[1100];
	cin >> S;
	int i = 0;
	while (S[i]!='\0')
		i++;
	if (S[i-1] == 's') {
		S[i] = 'e';
		S[i+1] = 's';
		S[i+2] = '\0';
	} else {
		S[i] = 's';
		S[i+1] = '\0';
	}
	cout << S << endl;
	return 0;
}

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

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	
	int sum[1000] = {};
	for(int i = 1; i <= 999; i++) sum[i] = sum[i - 1] + i;
	for(int i = 1; i < 999; i++) {
		if(sum[i] - a == sum[i + 1] - b) {
			cout << (sum[i] - a) << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
let a, b, c, d = Scanf.scanf "%d %d %d %d" (fun a b c d -> (a, b, c, d))

let () =
  let x = max a c in
  let y = min b d in
  if y - x > 0 then Printf.printf "%d\n" (y - x) else Printf.printf "%d\n" 0

Measured memory_bytes: 384
#include<stdio.h>

main(void){
   
  int N,a[100],i,j,tempo,c=0,mini;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }

  for(i=0;i<=N-1;i++){
    mini=i;
    for(j=i;j<=N-1;j++){
      if(a[j]<a[mini]){
	mini=j;
      }
    }
	tempo=a[i];
	a[i]=a[mini];
	a[mini]=tempo;
	if(a[i]!=a[mini])c=c+1;
  }

  for(i=0;i<N;i++){
    if(i==N-1){
      printf("%d\n",a[i]);
    }
    else printf("%d ",a[i]);
  }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        PrintWriter out = new PrintWriter(System.out);

        try {


    		String strInfo = br.readLine();
    		String strData = br.readLine();

    		String strInf[] = strInfo.split(" ", -1);

    		StringBuffer ans = new StringBuffer();

    		for (int i = 0 ; i < strData.length() ; i++) {
    			if (i+1 == Integer.parseInt(strInf[1])) {
        			ans = ans.append( (strData.charAt(i)+"").toLowerCase() );
    			}else {
        			ans = ans.append(strData.charAt(i));

    			}
    		}

    		System.out.print(ans.toString());
            out.flush();


        } catch (IOException e) {

        }


    }


}

Measured memory_bytes: 20692
short*p,v[][99];main(c,n,m,i,y){for(;m=scanf("%d %[^\n] %[^\n]",&n,v,v+1)*n;printf(m>n?"NA\n":"%d\n",m))for(i=2;i--;m=c)for(c=0,y=n;y-->1&c<m;y+=y==n|*p&2?2:*p&p[-1]&1?0:!++c-1)p=y+v[c+i&1];}

Measured memory_bytes: 0