akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main()
{
   int n[3];
   int i, j, temp;
   
   scanf("%d %d %d", &n[0], &n[1], &n[2]);
   
   for (i = 0; i < 3; ++i){
      for (j = i + 1; j < 3; ++j){
         if (n[i] > n[j]){
            temp = n[i];
            n[i] = n[j];
            n[j] = temp;
         }
      }
   }
   
   printf("%d %d %d\n", n[0], n[1], n[2]);
   return (0);
}

Measured memory_bytes: 1816
#include<stdio.h>
int main()
{
	int n, min, max, tmp, ans;

	scanf("%d", &n);

	min = 1000000000;
	max = 1;

	for (int i = 0; i < n; i++) {
		scanf("%d", &tmp);

		if (tmp >= max)
			max = tmp;

		if (tmp <= min)
			min = tmp;
	}

	ans = (max - min);

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

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int n,ans=0,cnt=0,a=0,b=inf;
  cin >> n;
  set<int> st;
  rep(i,n){
    int x;
    cin >> x;
    if(st.find(x)!=st.end()){
      cnt++;
      a = min(a,x);
      b = max(b,x);
    } else {
      st.insert(x);
    }
  }
  ans = st.size();
  if(cnt%2){ans--;}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int dp[100005];
int count(int ar[],int i,int n){
	if(dp[i]==-1){
		if(i==n-1)
			return 0;
		if(i>=n)
			return INT_MAX;
		if(i==n-2)
			return abs(ar[i]-ar[i+1]);
		dp[i]=min(abs(ar[i]-ar[i+1])+count(ar,i+1,n),abs(ar[i+2]-ar[i])+count(ar,i+2,n));
	}
	return dp[i];
}
int main(){
	int n;
	cin>>n;
	int ar[n];
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++)
		cin>>ar[i];
	cout<<count(ar,0,n)<<endl;
	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,k;
  cin >> n >> k;
  int u[n];
  rep(i,n){
    cin >> u[i]; 
  }
  sort(u,u+n);
  if(n<=k){
    cout << 0 << endl;
    return 0;
  }
  int64_t ans=0;
  rep(i,n-k){
    ans+=u[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
while gets
  n, m = $_.split.map(&:to_i)
  break if n == 0 && m == 0
  x = y = 1
  rotate = [0,1]
  loop do
    str = gets.split
    case str[0]
    when "FORWARD"
      d = str[1].to_i
      x += rotate[0]*d
      y += rotate[1]*d
      x = n if x > n; x = 1 if x < 1
      y = m if y > m; y = 1 if y < 1
    when "BACKWARD"
      d = str[1].to_i
      x -= rotate[0]*d
      y -= rotate[1]*d
      x = n if x > n; x = 1 if x < 1
      y = m if y > m; y = 1 if y < 1
    when "RIGHT"
      rotate = [rotate[1], -rotate[0]]
    when "LEFT"
      rotate = [-rotate[1], rotate[0]]
    when "STOP"
      puts "#{x} #{y}"
      break
    end
  end
end

Measured memory_bytes: 8800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 
string A, B;
 
int main(void){
	
	cin >> A >> B;
	
	if(A == B) printf("EQUAL\n");
	else if(A.size() > B.size()) printf("GREATER\n");
	else if(A.size() < B.size()) printf("LESS\n");
	else{
	    for(int i = 0; i < A.size(); ++i){
	        if(A[i] > B[i]){ printf("GREATER\n"); return 0; }
	        if(A[i] < B[i]){ printf("LESS\n"); return 0; }
	    }
	}

    return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
m = [list(input()) for i in range(h)]
mon = [0]*2
mon[0]=list(input())
mon[1]=list(input())
ar = [None]*(h*w)
d = [[0,0],[0,1],[1,0],[1,1]]
wasure = 0
for i in range(h-1):
    for j in range(w-1):
        ma = 0
        for k in range(4):
            if m[i+d[k][0]][j+d[k][1]] == mon[d[k][0]][d[k][1]]:
                ma +=1
            else:
                l = k
        if ma == 3:
            moji = mon[d[l][0]][d[l][1]]
            y = i+d[l][0]
            x = j+d[l][1]
            if ar[(y*w)+x] is None:
                ar[(y*w)+x] = []
            
            ar[(y*w)+x].append(moji)
            # print('san',ar[(y*w)+x],y,x)
        elif ma ==4:
            for k in range(4):
                if ar[((i+d[k][0])*w)+j+d[k][1]] is None:
                    ar[((i+d[k][0])*w)+j+d[k][1]] = []
                ar[((i+d[k][0])*w)+j+d[k][1]].append('k')
                # print(ar[((i+d[k][0])*w)+j+d[k][1]],i+d[k][0],j+d[k][1])
            wasure += 1

ans = 0
are = {'J':0,'O':1,'I':2,'k':3}
for i in range((h*w)):
    if ar[i] is None:
        continue
    sore = [0]*4
    for j in range(len(ar[i])):
       sore[are[ar[i][j]]] += 1
       if sore[3] < max(sore[0:3]):
           ans = max(max(sore[0:3])-sore[3],ans)
print(wasure+ans)
# print(ar)

Measured memory_bytes: 75884
import sys
readline = sys.stdin.readline

N,X,Y = map(int,readline().split())
G = [[] for i in range(N)]

for i in range(N - 1):
  G[i].append(i + 1)
  G[i + 1].append(i)
  
G[X - 1].append(Y - 1)
G[Y - 1].append(X - 1)

ans = [0] * N

from collections import deque
for i in range(N):
  q = deque([])
  q.append([i, -1, 0])
  seen = set()
  while q:
    v, parent,cost = q.popleft()
    if v in seen:
      continue
    seen.add(v)
    ans[cost] += 1
    for child in G[v]:
      if child == parent:
        continue
      q.append([child, i, cost + 1])
      
for i in range(1, N):
  print(ans[i] // 2)


Measured memory_bytes: 85032
#include <bits/stdc++.h>
using namespace std;
int main(){
    int m,n,A=0;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        A+=a[i];
    }
    sort(a,a+n,greater<int>());
    if(a[m-1]<(float)A/4/m)
        cout<<"No";
    else cout<<"Yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  if((N[0] == N[1] && N[1] == N[2]) || (N[2] == N[3] && N[1] == N[2]))
    cout << "Yes" << endl;
  else
    cout <<"No" <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int a[20],n,s,h;
string v;
main()
{
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//cout.tie(0);
	a[0]=1;
	for(int i=1;i<=15;i++)
	  a[i]=a[i-1]*10;
	s=0;
	for(int i=10;i>=1;i--)
	  {
		int check = a[i]-1;
		cout << "? " << check << "\n";
		fflush(stdout);
		cin >> v;
		//h++;
		if(v == "N") 
		{
			s = i+1;
		break;
	    }
	  }
	if(s==0)
	  {
	  	for(int i=10;i>=0;i--)
	  	 {
		 int check = a[i];
		 cout << "? " << check << "\n";
		 fflush(stdout);
		 cin >> v;
		 //h++;
		 if(v == "Y"&& i==10) 
		   {
		   	cout << "! " << 1 << "\n";
		    fflush(stdout);
			//s = i+1;
		    exit(0);
		   }
		  if(v=="Y")
		   {
		   	s=i+1;
		   	break;
		   }
	      }
	    
	  }
	int l,r,gi;
	l=a[s];
	r=a[s+1]-10;
	gi=0;
	while(l<r)
	 {
	 	int mid;
	 	mid=(l+r)/2;
	 	if(mid==gi) break;
		 else gi=mid;
	 	cout << "? " << mid << "\n";
		fflush(stdout);
		cin >> v;
		if(v == "Y") r=mid;
		  else l=mid;
	    h++;
	 }
	if(r/10!=0) cout<<"! "<<r/10<<endl;
	  else cout<<"! "<<1<<endl;
    fflush(stdout);
    //cout<<h<<endl;
}


Measured memory_bytes: 596
n, a, b = map(int, input().split())
H = [int(input()) for _ in range(n)]
c = a - b
def is_can(x):
  s = 0
  d = b*x
  for h in H:
    s += max(0, -(-(h-d) // c))
  if s <= x:
    return True
  return False

ng = 0
ok = -(-max(H)//b)
while ok - ng > 1:
  m = (ok+ng)//2
  if is_can(m):
    ok = m
  else:
    ng = m
print(ok)

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

int main(){
    ll n;
    cin >> n;
    vector<pair<ll,ll>> l(n), s(n+1);
    rep(i, 0, n){
        ll t;
        cin >> t;
        l[i] = {t, i+1};
    }
    sort(l.begin(), l.end());
    rep(i, 0, n){
        s[l[i].second] = {l[i].first, i+1};
    }
    rep(i, 1, n+1){
        if(s[i].second > n/2){
            cout << l[n/2-1].first << endl;
        }else{
            cout << l[n/2].first << endl;
        }
    }
    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    rep(i, N){
        cin >> A[i];
    }
    rep(i, N){
        if(A[i] == 0){
            cout << 0 << endl;
            return 0; 
        }
    }
    __int128_t ans = 1;
    ll a = pow(10, 18);
    rep(i, N){
        ans *= A[i];
        if(ans > a || ans < 0){
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans2 = ans;
    cout << ans2 << endl;


    return 0;
}

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

using namespace std;

int k;

int gcd(int a, int b)
{
    while(b)
    {
        a %= b;
        swap(a, b);
    }
    return a;
}

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

    cin >> k;

    long long sum = 0;
    for(int a = 1; a <= k; a++)
    {
        for(int b = 1; b <= k; b++)
        {
            for(int c = 1; c <= k; c++)
                sum += gcd(gcd(a, b), c);
        }
    }

    cout << sum;

    return 0;
}


Measured memory_bytes: 3620
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

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

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool is_uruu(int y) {return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;}
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}

/* }}} */

int j, y;

void dfs(int jp, int yp, string s)
{
  if (jp > j || yp > y) return;

  if (jp == j && yp == y){
    print(s);
    return;
  }

  if (jp == 5 && yp == 5) return;
  if (max(jp, yp) == 5 && min(jp, yp) <= 3) return;
  if (max(jp, yp) == 6 && min(jp, yp) == 4) return;

  dfs(jp + 1, yp, s + "A");
  dfs(jp, yp + 1, s + "B");
}

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

  cin >> j >> y;
  dfs(0, 0, "");

  return 0;
}

Measured memory_bytes: 1188
#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 FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
/////////////////////////(๑•﹏•๑｀)/////////////////////////
int main() {
	string S;
	int w;
	getline(cin,S);
	SCD(w);

	REP(i,S.length()){
		if ( i % w != 0) continue;
		cout << S[i];
	}


	cout << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;
int main() {
    double W,H;
    double x,y;
    cin >> W >> H >> x >> y;
    double cx, cy;
    cx = W / 2;
    cy = H / 2;
    int d = 0;
    if (cx == x && cy == y) d = 1;
    cout << setprecision(10) << (W * H) / 2 << " " << d << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair< ll,pair<ll , ll> >; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
////////////////

// c++17での名前衝突を避けるためdefine
#define gcd nyagcd
#define lcm nyalcm
ll nyagcd(ll x, ll y){
  ll z;
  if(x > y) swap(x,y);
  while(x){
    x = y % (z = x); y = z;
  }    
  return y;
}
ll nyalcm(ll x,ll y){
  return 1LL * x / gcd(x,y) * y;
}

void solve(){
  ini(N);
  ins(S,T);
  rep(i , N){
    cout << S[i] << T[i];
  }
  cout << endl;



}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}

int main() {
  ll a,b,c,d;cin>>a>>b>>c>>d;
  ll ans;
  
  ll low=0;
  ll hi=0;
  if(a%c==0) {
    low=a/c;
  } else {
    low=a/c+1;
  }
  hi=b/c;
  ll divc=hi-low+1;
  
  if(a%d==0) {
    low=a/d;
  } else {
    low=a/d+1;
  }
  hi=b/d;
  ll divd=hi-low+1;
  
  ll cd=c*d/gcd(c,d);
  if(a%cd==0) {
    low=a/cd;
  } else {
    low=a/cd+1;
  }
  hi=b/cd;
  ll divcd=hi-low+1;
  
  ll div = divc+divd-divcd;
  ll all = b-a+1;
  ans = all-div;
  cout << ans << endl;
}


Measured memory_bytes: 256
w,h,n = map(int,input().split())
cnt = 0
k = [[False for i in range(w)] for j in range(h)]
while(cnt < n):
    x,y,a = map(int,input().split())
    
    if(a == 1):
        for i in range(h):
            for j in range(x):
                k[i][j] = True
    elif(a == 2):
        for i in range(h):
            for j in range(x,w):
                k[i][j] = True
    elif(a == 3):
        for i in range(y):
            for j in range(w):
                k[i][j] = True
    elif(a == 4):
        for i in range(y,h):
            for j in range(w):
                k[i][j] = True
    cnt += 1
sum = 0
for i in range(h):
    sum += k[i].count(False)
print(sum)

Measured memory_bytes: 9256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
// import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        ) {

      String[] lns = in.readLine().split(" ");
      int n = Integer.parseInt(lns[0]);
      int m = Integer.parseInt(lns[1]);
      City[] city = new City[m];
      City[] city2 = new City[m];
      int[] pref = new int[n+1];

      int x,y;
      for(int i=0; i<m; i++) {
        lns = in.readLine().split(" ");
        x = Integer.parseInt(lns[0]);
        y = Integer.parseInt(lns[1]);
        city2[i] = city[i] = new City(i, x, y);
      }

      Arrays.parallelSort(city2, new Comparator<City>() {
        public int compare(City a, City b) {
          if(a.y == b.y) return 0;
          return a.y > b.y ? 1 : -1;
        }
      });

      for (City c : city2)
        c.no = ++pref[c.p];

      // String no;
      StringBuilder buf = new StringBuilder();
      String[] pre0 = {"000000","00000","0000","000","00","0",""};
      for(int i=0, p, no; i<m; i++) {
        // no = String.format("%06d%06d", city[i].p,city[i].no);
        p  = city[i].p;
        no = city[i].no;
        buf.append(pre0[len(p)])
           .append(p)
           .append(pre0[len(no)])
           .append(no)
           .append('\n');
        // out.println(no);
      }
      // out.flush();
      System.out.print(buf);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  int len(int n) {
    int i=1;
    for(int j=10; ; i++, j*=10)
      if(n<j) break;
    return i;
  }
  class City {
    int s;
    int p;
    int y;
    int no;

    public City(int s, int p, int y) {
      this.s = s;
      this.p = p;
      this.y = y;
    }
  }
}

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define mod 1000000007
#define INF 100000000
#define fk first
#define sv second

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  while (cin >> a >> b){
    int res = a + b, ct = 0;
    while (res != 0){
      ct++;
      res /= 10;
    }
    cout << ct << endl;
  }
}

Measured memory_bytes: 3080
S = input()
N = len(S)
ret = 0

for i in range(N):
    for j in range(i + 1, N+1):
        f = True
        for s in S[i:j]:
            if s not in 'ACGT':
                f = False
                break

        if f:
            ret = max(ret, j - i)

print(ret)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>

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

int main() {
    int n, k, q;
    vector<int> a;
    vector<int> p;
    int ans = 0;

    cin >> n >> k >> q;

    for (int i = 0; i < q; i++) {
         int aa;
         cin >> aa;
         a.push_back (aa);
    }

    for (int i = 0; i < n; i++) {
        p.push_back (0);
    }

    for (int i = 0; i < q; i++) {
        p[a[i] - 1] += 1;
    }

    for (int i = 0; i < n; i++) {
        ((k + p[i] - q) > 0) ? (cout << "Yes" << endl) : (cout << "No" << endl);
    }
}



Measured memory_bytes: 1528
// https://atcoder.jp/contests/abc009/tasks/abc009_3
// 未解決
#include <bits/stdc++.h>
#include <string>
using namespace std;

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素

struct Bridge{
    int a;
    int b;
    bool c=false;
};

int main(){
    int n,m;
    cin>>n>>m;
    vector<Bridge> br(m);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        br[i].a=a;
        br[i].b=b;
    }
    sort(br.begin(),br.end(),[](auto const& lhs, auto const& rhs)
    {return lhs.b < rhs.b;});
    int ans=0;
    rep(i,m){
        int x;
        if(!br[i].c){
            ans++; 
            x=br[i].b-1;
            for(int j=i;j<m;j++){
                if(br[j].c) continue;
                if(br[j].a<=x) br[j].c=true;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define INF 1000000000
#define ll long long

int main()
{
	string s;
	cin >> s;
	if (s.size()>=4 && s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef unsigned long long ULL;
 
template<class T>
inline bool read(T &num)  
{
       char in;bool IsN=false;
       while(in=getchar(),in!='-'&&(in<'0'||in>'9'))if(in==EOF)return false;
       in=='-'?(IsN=true,num=0):num=in-'0';
       while(in=getchar(),in>='0'&&in<='9')num=num*10+in-'0';
       return IsN?num=-num:num,true;
}
 
 
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define __m  int mid=l+(r-l)/1
 
const int maxn   = 2e6 + 7;
const LL  inf_LL = 9e18   ;
const int inf    = 2e9 + 7;
const int mod    = 1e9 + 7;
int main() {
#ifdef LOCAL
    freopen("sample.in", "r", stdin);
#endif
    string now;
    cin>>now;
    bool yes=false;
    for(int i=0;i<now.length();i++)
    {
        if(now[i]=='9')
            yes=true;
    }
    if(yes)
        cout<<"Yes"<<endl;
    else 
        cout<<"No"<<endl;
    return 0;
}


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

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;

int32_t main(){
    boost;
    int n;
    cin >> n;
    int a[n];

    for(int i = 0 ; i < n ; ++i){
    	cin >> a[i];
    }

    int out = 1e18;
    for(int i = -100 ; i <= 100 ; ++i){
    	int ans = 0;
    	for(int j = 0 ; j < n ; ++j){
    		ans += (a[j] - i)*(a[j] - i);
    	}
    	out = min(ans,out);
    }

    cout << out;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
     
    int main(){
      int ans=1;
      int N,K;
      cin>>N>>K;
      for(int i=0;i<N;i++){
        ans=min(2*ans,ans+K);
      }
      cout<<ans<<endl;
      return 0;
     
    }

Measured memory_bytes: 256
from collections import defaultdict

N, X, Y = map(int, input().split())
X, Y = X - 1, Y - 1
dist_to_cnt = defaultdict(int)
for i in range(N):
    for j in range(i, N):
        dist = min(j - i, abs(i - X) + 1 + abs(Y - j))
        dist_to_cnt[dist] += 1
for i in range(1, N):
    print(dist_to_cnt[i])

Measured memory_bytes: 3948
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        System.out.println( (H-h) * (W-w) );
    }
}


Measured memory_bytes: 23252
/*
Stay innocent, be naive. 
But still dream big. 
Dream big to the point that it is beyond your ability and endeavour to achieve it. 
So dream big and don’t lose your innocence.
*/
import java.util.*;
import java.io.*;

   public class Main
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         System.out.println(N*N*N);
      }
   }

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000
using ll = long long;

int main(){
  int n;
  cin >> n;
  vector<int> B(n);
  rep(i,n)cin >> B.at(i);
  int ans = B.at(0)+B.at(n-2);
  rep1(i,n-1){
    ans+=min(B.at(i-1),B.at(i));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
r,c = map(int,input().split())

table = [list(map(int,input().split())) for i in range(r)]

for i in range(r):
    table[i].append(sum(table[i]))

table.append([])
for j in range(c+1):
    s = 0
    for i in range(r):
        s += table[i][j]
    table[r].append(s)

for i in range(r+1):
    print(' '.join(map(str,table[i])))



Measured memory_bytes: 5704
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
#define rep(i,N) for(int i=0;i<(int)N;++i)
//cout << fixed << setprecision(20) << *** << endl;
typedef long long ll;
using namespace std;
int main()
{
	ll N;
	vector<ll>vec,ANS;
	cin>>N;
	rep(i,N){
		ll t;
		cin>>t;
		vec.push_back(t);
	}
	sort(vec.begin(),vec.end());
	ll summ=0;
	rep(i,N){
		summ=summ+vec[i];
	}
	if(summ%10==0){
		rep(i,N){
			ll sum=0;
			rep(j,N){
				if(j!=i)sum=sum+vec[j];
			}
			if(sum%10!=0)ANS.push_back(sum);
			else ANS.push_back(0);
			//cout<<sum<<endl;
			sum=0;
		}
		sort(ANS.begin(),ANS.end());
		cout<<*(ANS.end()-1)<<endl;
	}
	else{
		cout<<summ<<endl;
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)
#define rrep(i, a, N) for(int i = a; i >= N; i--)

int main() {
    string s;
    cin >> s;

    int cnt1 = 0;
    char c1 = '0';
    rep(i, 0, s.length()) {
        if (s[i] != c1) cnt1++;
        if (c1 == '0') c1 = '1';
        else c1 = '0';
    }

    int cnt2 = 0;
    char c2 = '1';
    rep(i, 0, s.length()) {
        if (s[i] != c2) cnt2++;
        if (c2 == '0') c2 = '1';
        else c2 = '0';
    }

    cout << min(cnt1, cnt2) << endl;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){ 
  int X, Y; cin >> X >> Y;
  bool fg = false;
  rep(i, 200){
    rep(j, 200){
      if(i+j==X && 2*i+4*j==Y)fg = true;
    }
  }

  if(fg) cout << "Yes" << ln;
  else cout << "No" << ln;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b,c,s;
  cin >> a >> b >> c;
  s = a+b+c;
  if( s == "575" || s=="557"|| s=="755"){
    cout << "YES";
  }
  else{
    cout <<"NO";
  }
}

Measured memory_bytes: 256
n, m, x = list(map(int, input().split()))
c = []
a = []

def calc_price(bit):
  price_total = 0
  learn_total = [0]*m
  
  for i in range(n):
    if (bit >> i) & 1:
      price_total += c[i]
      learn = a[i]
      for j, la in enumerate(learn):
        learn_total[j] += la
  
  if check(learn_total):
    return price_total
  else:
    return INF
  
def check(learn_total):
  for i in range(m):
    if learn_total[i] < x:
      return False
  return True
    
for i in range(n):
  c_temp, *a_temp = list(map(int, input().split()))
  c.append(c_temp)
  a.append(a_temp)
  
INF = float("inf")
ans = INF

for bit in range(1 << n):
  price = calc_price(bit)
  ans = min(ans, price)
  
if ans == INF:
  print(-1)
else:
  print(ans)
  

Measured memory_bytes: 9240
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i ++)
#define for1(i, n) for (int i = 1; i <= n; i ++)
#define repn(i, n) for (int i = n-1; i >= 0; i --)
#define rep1(i, n) for (int i = n; i >= 1; i --)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define f first
#define s second
using namespace std;
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef queue<int> qi;
typedef queue<pii> qpii;

void test_case() {
	ll a; cin >> a;
	cout << a + a*a + a*a*a << '\n';
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int q = 1;
	//cin >> q; 
	while (q--) {
		test_case();
	}
	return 0;
}


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

int main(void){
    int a=0;
    int b=0;
    int sum=0;
    cin >> a;
    cin >> b;
    if(a>b){
        sum+=a;
        a--;
    }else{
        sum+=b;
        b--;
    }

    if(a>b){
        sum+=a;
        a--;
    }else{
        sum+=b;
        b--;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::cmp;

#[allow(dead_code)]
fn getline() -> Vec<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s.split(' ').map(|x| x.trim().to_string()).collect::<Vec<String>>()
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>(s: &String) -> T {
    s.parse().ok().unwrap()
}

struct Bit<T, F> {
    n: usize,
    dat: Vec<T>,
    op: F,
    unit: T,
}

impl<T: Clone, F: Fn(&mut T, &T)> Bit<T, F> {
    #[allow(dead_code)]
    fn new(n: usize, op: F, unit: T) -> Self {
        Bit {
            n: n,
            dat: vec![unit.clone(); n + 1],
            op: op,
            unit: unit,
        }
    }
    #[allow(dead_code)]
    fn from_vec(mut v: Vec<T>, op: F, unit: T) -> Self {
        let n = v.len();
        let mut dat = vec![unit.clone()];
        dat.append(&mut v);
        for i in 1..n {
            let j = i as i32;
            let b = (j & -j) as usize;
            let x = dat[i].clone();
            op(&mut dat[i + b], &x);
        }
        Bit {
            n: n,
            dat: dat,
            op: op,
            unit: unit,
        }
    }
    fn operate(&mut self, k: usize, a: &T) {
        let mut k = k;
        while k <= self.n {
            (self.op)(&mut self.dat[k], &a);
            let l = k as i32;
            k += (l & -l) as usize;
        }
    }
    fn accum(&self, k: usize) -> T {
        let mut k = k;
        let mut sum = self.unit.clone();
        while k > 0 {
            (self.op)(&mut sum, &self.dat[k]);
            let l = k as i32;
            k -= (l & -l) as usize;
        }
        sum
    }
}

fn main() {
    let nm = getline();
    let n: i32 = get(&nm[0]);
    let m: usize = get(&nm[1]);
    let mut lrs: Vec<Vec<(i32,i32)>> = vec![vec![]; m + 1];
    for _ in 0..n {
        let lr = getline();
        let l: i32 = get(&lr[0]);
        let r: i32 = get(&lr[1]);
        lrs[(r - l + 1) as usize].push((l, r + 1));
    }
    let mut total = 0;
    let mut bit = Bit::new(m, |x, y| *x += *y, 0);
    for d in 1..m+1 {
        let mut ans = n;
        ans -= total;
        total += lrs[d].len() as i32;
        for i in 1.. {
            let x = i * d;
            if x > m {
                break;
            }
            ans += bit.accum(x);
        }
        for &(l, r) in &lrs[d] {
            bit.operate(l as usize, &1);
            bit.operate(r as usize, &-1);
        }
        println!("{}", ans);
    }
}


Measured memory_bytes: 13180
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b= [0]*q
c= [0]*q
for i in range(q):
    b[i],c[i] = map(int,input().split())

import collections
co = collections.Counter(a)

ans = sum(a)

for i in range(q):
    co[c[i]] += co[b[i]]
    ans = ans + (c[i]-b[i])*co[b[i]]
    co[b[i]] = 0
    print(ans)

Measured memory_bytes: 30000
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int[] a = new int[n];
			for(int i = 0 ; i < n ; i++) {
				a[i] = sc.nextInt();
			}
			Arrays.stream(a).filter(value -> value % 2 == 0).forEach(value -> {
				if(value % 3 != 0 && value % 5 != 0) {
					System.out.println("DENIED");
					System.exit(0);
				}
			});
			System.out.println("APPROVED");
		}

	}

}


Measured memory_bytes: 29012
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main(void){
	
	int n;
	scanf("%d",&n);
	if( n%10 == 7 || (n%100)/10 == 7 || n/100 == 7 ){ printf("Yes");}
	else printf("No");
	
}

Measured memory_bytes: 1724
// Problem : B - Count ABC
// Contest : AtCoder Beginner Contest 150
// URL : https://atcoder.jp/contests/abc150/tasks/abc150_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);
 
const int N = 3e5+5;
const int MOD = 1e9+7;

int32_t main()
{
    	IOS;
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	for(int i = 0; i + 2 < n; i++)
	{
		if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C')
			cnt++;
	}
	cout << cnt << endl;
    	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
void swap(int & a, int & b){
	int t=a;
	a=b;
	b=t;
}
int n;
bool g(int * a){
	for(int i=0;i<n;i++){
		if(a[i] != i+1) return false;
	}
	return true;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	if(g(a)){
		cout<<"YES"; return 0;
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			swap(a[i],a[j]);
			if(g(a)){
				cout<<"YES\n"; return 0;
			}
			swap(a[i],a[j]);
		}
	}
	cout<<"NO";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}

int main() {
	int i, l, r, flag = 0;
	char s[222222];
	cin >> s;
	for (i = 0; s[i] != '\0'; i++) {
		if (s[i] == 'A'&&flag == 0) {
			l = i;
			flag++;
		}
		if (s[i] == 'Z')
			r = i;
	}
	cout << r - l + 1 << endl;
}

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

int main()
{
    int a,b,c,x,y,z;
    cin>>a>>b>>c;
    x=a+b;
    y=b+c;
    z=c+a;
    if(x>y && x>z)
    {
        if(y>z)
        {
            cout<<z<<endl;
        }
        else
        {
            cout<<y<<endl;
        }
    }
    else if(y>z && y>x)
    {
        if(z>x)
        {
            cout<<x<<endl;
        }
        else
        {
            cout<<z<<endl;
        }
    }
    else if(z>x && z>y)
    {
        if(x>y)
        {
            cout<<y<<endl;
        }
        else
        {
            cout<<x<<endl;
        }
    }
    else if(x==y && y==z)
    {
        cout<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 3608
//BISMILLAHIR RAHMANIR RAHIM
                                               //BY THE NAME OF ALLAH
                                               //FAISAL AHAMMED SHAWON
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<set>
#include<map>
#include<iterator>
#include<numeric>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define SQ(a) (a)*(a)
#define pi acos(-1.0)
const int MAX=100001;
const int MOD=1e9+7;
int ara[MAX];
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

bool f(ll a,ll b)
{
    return a>b;
}
ll max_sum_subarrays(ll ara[],ll n)
{
    ll ans=0,sum=0;
    for(ll k=0;k<n;k++){
        sum=max(ara[k],sum+ara[k]);
        ans=max(ans,sum);
    }
    return ans;
}
ll num_divisors(ll n)
{
    long long cnt=0;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0 && i*i==n)
            cnt+=1;
        if(n%i==0 && i*i!=n)
                cnt+=2;
    }
    return cnt;
}
ll comb(ll m, ll n)
{
    ll x = max(m-n,n),ans = 1,i=1;
    for(ll k=m;k>=x+1;k--){
        ans*=k;
        ans/=i;
        i++;
    }
    return ans;
}
ll binsearch(ll low,ll high,ll target)
{
    while(low<=high)
    {
        ll mid=(low+high)/2;
        if(ara[mid]>target)
            high=mid-1;
        else if(ara[mid]<target)
            low=mid+1;
        else return mid;
    }
    return -1;
}
void solve()
{
    int a,b;
    cin>>a>>b;
    if(a==b)
    {
        for(int i=1;i<=a;i++)
        {
            cout<<b;
        }
        cout<<endl;
        return;
    }
    int x=max(a,b);
    int y=min(a,b);
    for(int i=1;i<=x;i++)
        cout<<y;
    cout<<endl;
}
int main()
{
    fast();
    solve();
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long 
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

int main()
{
    ll n,m,i,a,b,k,t;
    cin>>n;
    ll sum=0;
    map<ll,ll> mp;
    for(i=0;i<n;i++)
    {
        cin>>a;
        mp[a]++;
        sum+=a;
    }
    ll dup=sum;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        ll have=mp[a];
        sum-=a*have;
        sum+=b*have;
        mp[a]=0;
        mp[b]+=have;
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 9364
package main

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

type circle struct {
	x int
	y int
	r int
}

type rectangle struct {
	w int
	h int
}

type coordinate struct {
	x int
	y int
}

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	// W:長方形の横、H:長方形の縦
	w, h, x, y, r := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()

	cir := circle{
		x: x,
		y: y,
		r: r,
	}

	rect := rectangle{
		w: w,
		h: h,
	}
	// fmt.Fprintln(out, cir, rect)

	if check(cir, rect) {
		fmt.Fprintln(out, "Yes")
	} else {
		fmt.Fprintln(out, "No")
	}
}

func check(cir circle, rect rectangle) bool {
	leftPoint := coordinate{
		x: cir.x - cir.r,
		y: cir.y,
	}
	rightPoint := coordinate{
		x: cir.x + cir.r,
		y: cir.y,
	}
	topPoint := coordinate{
		x: cir.x,
		y: cir.y + cir.r,
	}
	buttomPoint := coordinate{
		x: cir.x,
		y: cir.y - cir.r,
	}

	checkLeft := checkPoint(leftPoint, rect)
	checkRight := checkPoint(rightPoint, rect)
	checkTop := checkPoint(topPoint, rect)
	checkButtom := checkPoint(buttomPoint, rect)

	// fmt.Fprintln(out, leftPoint, rightPoint, topPoint, buttomPoint)
	return checkLeft && checkRight && checkTop && checkButtom
}

func checkPoint(cood coordinate, rect rectangle) bool {
	// fmt.Println(cood, rect)
	if cood.x < 0 || cood.x > rect.w {
		return false
	}

	if cood.y < 0 || cood.y > rect.h {
		return false
	}
	// fmt.Println("TRUE")
	return true
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}



Measured memory_bytes: 1176
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP          #-}

#define MOD 1000000007

main :: IO ()
main = do
    cs <- getLine
    print $ solve cs

solve :: String -> Int
solve cs = go 1 0 0 0 cs
  where
    go !e !a !ab !abc ('A':rest) = go e (rem (a + e) MOD) ab abc rest
    go !e !a !ab !abc ('B':rest) = go e a (rem (a + ab) MOD) abc rest
    go !e !a !ab !abc ('C':rest) = go e a ab (rem (ab + abc) MOD) rest
    go !e !a !ab !abc ('?':rest) = go (rem (3 * e) MOD) (rem (e + a * 3) MOD) (rem (a + ab * 3) MOD) (rem (ab + abc * 3) MOD) rest
    go _ _ _ abc [] = abc `rem` MOD


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

using namespace std;
#define N 123456
#define REP(i,n) for(int (i) = 0 ; (i) < (n) ; ++(i))

int anc[N];
int op[N];
int opv[N];
int markc[N];

int root(int x)
{
  return markc[x]>0?x:anc[x]=root(anc[x]);
}

int main()
{
  int n,q;
  while(cin >> n >> q,n+q){
    memset(anc,0,sizeof(anc));
    memset(op,0,sizeof(op));
    memset(opv,0,sizeof(opv));
    memset(markc,0,sizeof(markc));

    markc[0] = 1;
    REP(i,n-1){
      int a;
      cin >> a;
      anc[i+1]=a-1;
    }
   REP(i,q){
     char c;
     int a;
     cin >> c >> a;
     if(c == 'M'){
       op[i] = 1;
       markc[a-1]++;
     }
     opv[i] = a-1;
   }
   long sum = 0;
   for(int i = q-1;i>=0;--i){
     if(op[i]){
       markc[opv[i]]--;
     }else{
       sum += root(opv[i])+1;
     }
   }
   cout << sum << endl;
  }
}

Measured memory_bytes: 5020
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
    int N, c;
    string s, t;
    int a, i, j, k;

    cin >> N;
    cin >> s;
    cin >> t;

    a = 0;
    for (i = 0; i < N; i++) {
        c = 0;
        for (j= 0, k=i; k < N; j++, k++) {
            if (s[k] == t[j]) {
                c++;
            } else {
                break;
            }
        }
        if (k == N) {
            a = max({c, a});
            break;
        }
    }
    cout << 2*N - a << endl;
}


Measured memory_bytes: 256
while True:
    q = int(input())
    if q == -1:
        break
    x = q / 2
    while abs(pow(x, 3) - q) >= 0.00001 * q:
        x = x - (pow(x, 3) - q) / (3 * pow(x, 2))
    print("{:.6f}".format(x))

Measured memory_bytes: 7504
// #include <stdio.h>
// #include <vector>
#include <cmath>
// // #include <algorithm>
// using namespace std;

#include <vector>
#include <queue>
#include <climits>
#include <cstdio>

struct Node {
  // このノードから伸びるエッジの情報
  int number;
  std::vector<int> edges_to;    // 各エッジの接続先のノード番号
  std::vector<int> edges_cost;  // 各エッジのコスト

  // ダイクストラ法のためのデータ
  bool done;  // 確定ノードか否か
  int cost;   // このノードへの現時点で判明している最小コスト
  Node() {
    done = false;
    cost = INT_MAX;
  }
  bool operator> (const Node &node) const {
    return cost > node.cost;
  }
};

class MyGraph {
public:
  MyGraph(int numNodes) {
    this->numNodes = numNodes;
    nodes = std::vector<Node>(numNodes);
    doneCount = 0;
  }
  int numNodes;
  std::vector<Node> nodes;
  std::priority_queue<Node, std::vector<Node>, std::greater<Node> > queue;
  int doneCount;

  void addEdge(int edge_from, int edge_to, int edge_cost) {
    nodes[edge_from].number = edge_from;
    nodes[edge_from].edges_to.push_back(edge_to);
    nodes[edge_from].edges_cost.push_back(edge_cost);
  }
  void updateCost(int node_start) {
    nodes[node_start].cost = 0;
    queue.push(nodes[node_start]);
    while (!queue.empty()) {
      Node &node = nodes[queue.top().number];
      queue.pop();
      if (node.done) {
        continue;
      }
      //printf("%d\n", node.number);
      node.done = true;
      doneCount++;
      for (int i = 0; i < (int)node.edges_to.size(); ++i) {
        Node &nodeNext = nodes[node.edges_to[i]];
        if (!nodeNext.done && nodeNext.cost > node.cost + node.edges_cost[i]) {
          nodeNext.cost = node.cost + node.edges_cost[i];
          //printf("%d %d\n", nodeNext.number, node.cost + node.edges_cost[i]);
          queue.push(nodeNext);
        }
      }
    }
  }
  int getCost(int node_num) {
    return nodes[node_num].cost;
  }
};


int main(int argc, char const *argv[]) {
  int H, W;
  scanf("%d%d", &H, &W);
  char s[H][W];
  int b = 0;
  for (int i = 0; i < H; i ++) {
    scanf("%s", s[i]);
  }
  // for (int x = 0; x < H; x ++) {
  //   for (int y = 0; y < W; y ++) {
  //     printf("%c", s[x][y]);
  //   }
  //   printf("\n");
  // }
  MyGraph graph = MyGraph(H*W);
  for (int x = 0; x < H; x ++) {
    for (int y = 0; y < W; y ++) {
      if (s[x][y] == '#') {
        b++;
        continue;
      }
      for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
          int h = i ? pow(-1, j) : 0;
          int w = !i ? pow(-1, j) : 0;
          if (x + h >= 0 && x + h < H && y + w >= 0 && y + w < W) {
            if (s[x + h][y + w] != '#') {
              graph.addEdge(x*W + y, (x + h)*W + (y + w), 1);
            }
          }
        }
      }
    }
  }
  graph.updateCost(0);
  int cost = graph.getCost(H*W - 1);
  if (cost == INT_MAX) {
    printf("%d\n", -1);
  } else {
    //printf("%d %d %d\n", H*W, cost , b);
    printf("%d\n", H*W - (cost + 1) - b);
  }
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
#include <string>
#include <string.h>
#include <float.h>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

// Q1
int main()
{
	char szY[10];
	int nRCnt = 0;
	int nMax = 0;
	cin >> szY;

	for (int i = 0; i < 3; i++)
	{
		if (szY[i] == 'R')
			nRCnt++;
		else
			nRCnt = 0;
		if (nMax < nRCnt)
			nMax = nRCnt;
	}
	cout << nMax;
	return 0;
}

Measured memory_bytes: 3628