akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int n; cin >> n;
  vector<P> vec(n);
  rep(i, n) {
    int x, y; cin >> x >> y;
    vec[i] = P(x, y);
  }
  vector<int> cnt(n);

  const int q = 4e5;
  double delta = 2*PI/q;
  debugln(delta);
  rep(i, q) {
    double ma = -1e7;
    int pos = -1;
    double theta = delta*i;
    rep(j, n) {
      int x = vec[j].first;
      int y = vec[j].second;
      double now = y*cos(theta)+x*sin(theta);
      if (now > ma) {
        pos = j;
        ma = now;
      }
    }
    cnt[pos]++;
  }

  cout << setprecision(10);
  rep(i, n) {
    cout << (double)cnt[i]/q << endl;
  }

}


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}


int main(){
	ll n;
	cin >>n;
	ll a[n];
	ll sum=0;
	ll fulsum=0;
	FOR(i,n){
		cin >>a[i];
		fulsum+=a[i];
	}
	
	ll ans=1e18+19;
	
	FOR(i,n-1){
		sum+=a[i];
		ans=min(abs(fulsum-2*sum),ans);
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cstring>
#include<fstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
using namespace std;
#define N 200005
#define INF 1e9+7
int n,x,a[N],maxi=-1,mini=INF,ans;
int Abs(int p)
{
	return p>0?p:-p;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x);
		a[i]=2*x;
		maxi=max(x,maxi);
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]==(2*maxi))continue;
		if(Abs(maxi-a[i])<mini)
		{
			mini=Abs(maxi-a[i]);
			ans=a[i]/2;
		}
	}
	printf("%d %d",maxi,ans);
	return 0;
}

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

ll dfs(ll n) {
    if (n == 1) return 1;
    return 2 * dfs(n / 2) + 1;
}

int main() {
    ll h;
    cin >> h;

    cout << dfs(h) << endl;
    return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  ll cnt = 1;
  char ch;
  ll ans = 0;
  REP(i,n){
    if(i==0){
      ch = s[i];
      continue;
    }
    if(ch!=s[i]){
      cnt++;
      ch = s[i];
    }
  }
  cnt = max(1ll,cnt-2*k);
  ans = n-cnt;

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


Measured memory_bytes: 512
import java.lang.Math.abs

fun main(args: Array<String>) {
    val len = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }

    println(abs(num(a, 0) - num(b, 0)))
}

fun num(list: List<Int>, from: Int): Int {
    val size = list.size - from
    if (size == 1) return 1
    val rank = list.drop(from + 1).count { list[from] > it }
    return rank * fact(size - 1) + num(list, from + 1)
}

fun fact(n: Int): Int = if (n == 1) 1 else n * fact(n - 1)

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

int main(void){
    char S[11];
    scanf("%s",S);
    int length = strlen(S);
    int flag = 0;
    int num = 0;
    int tmp2=0;
    if(S[0]=='A'){
        flag++;
        for(int i=2;i<=length-2;i++){
            if(S[i]=='C') num++;
        }
        if(num==1) flag++;
        for(int j=0;j<length;j++){
            if(S[j]>='a' && S[j]<='z') tmp2++;
        }
        if(tmp2==length-2) flag++;
    }
    if(flag==3){
        printf("AC\n");
    }
    else{
        printf("WA\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	int d[55];
	for (i = 0; i < n; i++)
		scanf("%d", &d[i]);
	int ans = 0;
	for (i = 0; i < n; i++)
		for (j = i + 1; j < n; j++)
			ans += d[i] * d[j];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);


    string s;
    cin >> s;
    int n = sz(s);

    if (s[n - 1] == '2' || s[n - 1] == '4' || s[n - 1] == '5' || s[n - 1] == '7' || s[n - 1] == '9') {
        cout << "hon" << endl;
    } else if (s[n - 1] == '3') {
        cout << "bon" << endl;
    } else {
        cout << "pon" << endl;
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    int n;
    cin >> n;
    vector<int> v(n);

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

    int ans = 0;
    rep(i, n){
        int j1 = i, j2 = i;
        if(v[i] <= v[i+1]){
            for(j1 = i; j1 < n-1; j1++){
                if(v[j1] > v[j1+1]){
                    break;
                }
            }
        }

        if(v[i] >= v[i+1]){
            for(j2 = i; j2 < n-1; j2++){
                if(v[j2] < v[j2+1]){
                    break;
                }
            }
        }

        i = max(j1, j2);
        ans++;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n):
  if a[i - 1] > a[i]:
    step = abs(a[i] - a[i - 1])
    ans += step
    a[i] = a[i - 1]
print(ans)    

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

const int N = 1e6 + 10;
const int inf = INT_MAX;

#define ll long long
#define FOR(i,a,b) for(int i = a;i <= b;i++)
#define _FOR(i,a,b) for(int i = a;i >= b;i--)

template<typename T> void read(T &x)
{
    x = 0;int f = 1;
    char c = getchar();
    for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
    for(;isdigit(c);c = getchar()) x = x * 10 + c - '0';
    x *= f;
}

int x,y,d;
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
	read(x),read(y),read(d);
	int ans = 0;
	FOR(i,x,y)
	{
		if(i % d == 0) ans++;
	}
	printf("%d\n",ans);
    return 0;
}




Measured memory_bytes: 3744
n = gets.chomp.to_i
f = []
_p = []
ans = -(1 << 40)
n.times do |i|
    f << gets.chomp.split(" ").map(&:to_i)
end
n.times do |i|
    _p << gets.chomp.split(" ").map(&:to_i)
end

all_zero = true
[0, 1].repeated_permutation(10).each do |bits|
    if all_zero then
        all_zero = false
        next
    end
    sum = 0
    n.times do |i|
        count = 0
        bits.each_with_index do |bit, j|
            count += 1 if bit == 1 && f[i][j] == 1
        end
        sum += _p[i][count]
    end
    ans = ans < sum ? sum : ans
end

puts ans

Measured memory_bytes: 2044
// D - Not Divisible

// 約数を列挙する解法1

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

vector<int> enum_divisor(int n) {
	vector<int> result;
	for(int i=1; i*i <= n; i++){
		if(n % i == 0){
			result.push_back(i);
			if(i*i != n) result.push_back(n / i);
		}
	}

	return result;
}

int A[200000];
unordered_map<int, int> cnt;

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

	for (int i=0; i<N; i++) {
		cin >> A[i];
		cnt[A[i]]++;
	}

	int ans = 0;

	for (int i=0; i<N; i++) {
		if (cnt[A[i]] >= 2) continue;

		cnt[A[i]]--;

		vector<int> divisors = enum_divisor(A[i]);
		bool has_divisor = false;
		for (int d : divisors) {
			if (cnt[d] > 0) {
				has_divisor = true;
				break;
			}
		}

		if (has_divisor == false) ans++;

		cnt[A[i]]++;
	}

	cout << ans << endl;

	return 0;
}

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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main(void){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll x,k,d; cin>>x>>k>>d;
    if(x==0ll){
        if(k%2==0ll) cout<<0;
        else cout<<abs(d);
        return 0;
    }
    if(x>0ll){
        ll a=min(k,x/d);
        x-=a*d; k-=a;
        if(k==0) cout<<x;
        else{
            if(k%2==1ll) cout<<abs(x-d);
            else cout<<x;
        }
    }
    else{
        ll a=min(k,-x/d);
        x+=a*d; k-=a;
        if(k==0ll) cout<<abs(x);
        else{
            if(k%2==1ll) cout<<x+d;
            else cout<<abs(x);
        }
    }
    return 0;
}

Measured memory_bytes: 3648
from collections import deque

K = int(input())
l = [9,8,7,6,5,4,3,2,1]
lunlun = deque(l)
ans = l
for _ in range(K - 9):
    x = lunlun.pop()
    tmp = 10 * x + (x % 10)
    if x % 10 != 0:
        lunlun.appendleft(tmp - 1)
        ans.append(tmp - 1)
    lunlun.appendleft(tmp)
    ans.append(tmp)
    if x % 10 != 9:
        lunlun.appendleft(tmp + 1)
        ans.append(tmp + 1)
ans.sort()
print(ans[K - 1])


Measured memory_bytes: 22048
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    string s;
    cin >> s;
    int l = (int)(s.length());
    rep(i, l) cout << "x";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
import math
A,B,H,M = map(int,input().split())
a = abs(((H%12)/12*360+M/60*360/12)-(M/60*360))
b = min(a,360-a)
print((A**2+B**2-2*A*B*math.cos(math.radians(b)))**0.5)

Measured memory_bytes: 9572
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] d = new string[n];
        for (int i = 0; i < n; i++)
        {
            d[i] = Console.ReadLine();
        }
        var dis = d.Distinct();
        Console.WriteLine(dis.Count());
    }
}

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

class Cube{
public:
  int id;
  Cube* upper;
  Cube* lower;
  Cube(int id){
    this->id = id;
    upper = NULL;
    lower = NULL;
  }
  Cube(const Cube &c){
    this->id = c.id;
    this->upper = c.upper;
    this->lower = c.lower;
  }
  bool operator == (const Cube &c) const{
    return id == c.id;
  }
};

bool isSatisfied(Cube &low, Cube &high){
  Cube* c = &low;
  while(1){
    if(*c == high) return true;
    if(c->upper == NULL) return false;
    c = c->upper;
  }
  /*
  Cube c = Cube(low);
  while(1){
    if(c == high) return true;
    if(c.upper == NULL) return false;
    c = Cube(*c.upper);
  }
  */
}

void putOff(Cube &off){
  Cube* c = &off;
  if(c->lower != NULL){
    c->lower->upper = NULL;
    c->lower = NULL;
  }
  while(c->upper != NULL){
    c = c->upper;
    c->lower->upper = NULL;
    c->lower = NULL;
  }
  /*
  Cube c = Cube(off);
  while(c.upper == NULL){
    c = Cube(*c.upper);
    (*c.lower).upper = NULL;
      c.lower = NULL;
  }
  */
}

void putOn(Cube &low, Cube &high){
  assert(high.upper == NULL);
  assert(high.lower == NULL);
  Cube *c = &low;
  while(c->upper != NULL){
    c = c->upper;
  }
  c->upper = &high;
  c->upper->lower = c;

}

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int m;
  while(cin >> m, m){
    vector<Cube> cubes;
    for(int i = 0; i < m; i++){
      cubes.push_back(Cube(i+1));
    }
    int I, J;
    while(cin >> I >> J, I | J){
      if(J == 0){
        I--;
        if(cubes[I].lower == NULL) continue;
        putOff(cubes[I]);
        continue;
      }
      I--; J--;
      if(isSatisfied(cubes[J], cubes[I])) continue;
      putOff(cubes[I]);
      putOn(cubes[J], cubes[I]);
    }
    vector<int> ans;
    for(size_t i = 0; i < cubes.size(); i++){
      if(cubes[i].lower == NULL){
        int cnt = 1;
        Cube *c = &cubes[i];
        while(c->upper != NULL){
          cnt++;
          c = c->upper;
        }
      ans.push_back(cnt);
      }
    }
    sort(ans.begin(), ans.end());
    for(size_t i = 0; i < ans.size(); i++){
      cout << ans[i] << endl;
    }
    cout << "end" << endl;
  }
  return 0;
}

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

#define int long long

#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))
#define upp(a,b) upper_bound(all(a),(b))
#define fill(i,n) memset(i,n,sizeof(i)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N,ans;
signed main() {
    IOS();
    /*シフト演算は(1ll<<x)*/
    
    cin>>N;
    rep(i,0,N){
        int a,b;
        cin>>a>>b;
        ans+=b-a+1;
    }
    
cout<<ans<<endl;    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] abc = scanner.nextLine().split(" ", 3);

        int[] arr = new int[3];
        arr[0] = Integer.parseInt(abc[0]);
        arr[1] = Integer.parseInt(abc[1]);
        arr[2] = Integer.parseInt(abc[2]);
        Arrays.sort(arr);

        System.out.println(arr[0] + arr[1]);
    }
}


Measured memory_bytes: 21332
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      
      int xor = 0;
      for (int i = 0; i < N; ++i) {
        xor ^= in.nextInt();
      }
      
      if (xor == 0) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}

Measured memory_bytes: 49108
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int n; cin >> n;
    int sum = 0;
    int max = 0;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        if (tmp > max) {
            max = tmp;
        }
        sum += tmp;
    }
    cout << sum - max / 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;


int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        int a=s.at(i)-'A';
        a=(a+n)%26;
        char b=a+'A';
        cout<<b;
    }
    cout<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, h: int, w: int):
    print((H - h) * (W - w))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    h = int(next(tokens))  # type: int
    w = int(next(tokens))  # type: int
    solve(H, W, h, w)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {  

char num[1001];    

int a, sum;    

while(1){      

scanf("%s" ,num);      

if(num[0]=='0')break;      

sum = 0;      

for(a = 0;num[a]!='\0';a++){        

sum+=num[a]-'0';       

}      

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

}  

return 0;

}

Measured memory_bytes: 536
#include <bits/stdc++.h>
using namespace std;
int main() {
int A, B; cin >> A >> B; int ans;
if (A > B) {
ans = A + (A-1); }
else if (B > A) { ans = B + (B-1);
}
else {
ans = A + B; }
cout << ans << endl; }

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Main {
  private static int a, b;
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    List<String> num_st = new ArrayList<String>();
    while (stdIn.hasNextInt()) {
      a = stdIn.nextInt();
      b = stdIn.nextInt();
      num_st.add(String.valueOf(a+b));
    }
    for (String  sum: num_st) {
      System.out.println(sum.length());
    }
  }
}

Measured memory_bytes: 26144
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second

ll mod = 998244353;

ll n,a,b,k;

ll nc[500000];

ll mod_pow(ll x,ll n) {
	ll ret = 1;
	while(n > 0) {
		if(n & 1)(ret *= x) %= mod;
		(x *= x) %= mod;
		n /= 2;
	}
	return ret;
}

int main() {
	cin >> n >> a >> b >> k;

	nc[0] = 1;

	FOR(k,1,n + 1) {
		(nc[k] = nc[k - 1] * (n - k + 1)) %= mod;

		(nc[k] *= mod_pow(k,mod - 2)) %= mod;
	}

	ll ans = 0;
	REP(i,n + 1) {
		if(k - a * i < 0 || (k - a * i) % b) 
			continue;

		ll j = (k - a * i) / b;
		if(j > n)continue;

		(ans += nc[i] * nc[j]) %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] x = new int[5];
        for (int i = 0; i < x.length; i++) {
            x[i] = sc.nextInt();
            if (x[i] == 0) {
                System.out.println(i + 1);
                break;
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 35688
/* Author - Ankur Kumar Singh 
    	IDE :- Offine Linux
     ---------------------------------*/
    #include <bits/stdc++.h>
    using namespace std;
    /* variable type :- */
    	/* variable type :- */
    	# define ll  long long int
    	# define ld  long double
    	# define I ll
    	# define mod 1000000007
    /* map */
    	# define abc  pair< ll, ll>
    	map < pair < abc,abc > ,  ll > pqr;
    	map <  pair <  ll, ll > , ll > xyz;	
    /* vector */
    	# define pb push_back
    	# define pp pop_back
    	# define ff first
    	# define ss second
    	# define mp make_pair
    	# define ac accumulate
    	vector<pair<ll,string>>a1;
    	vector<pair<ll,string>>a2;
    	vector<pair<ll,string>>a3;
    	vector<pair<ll,string>>a4;
    	vector<pair<ll,string>>a5;
    	vector<pair<ll,string>>a6;
    	vector<pair<ll,string>>a7;
    	vector<pair<pair<ll,ll>,ll>>b;
    	ll cnt;
    	ll X[121],Y[121];
     
  
    int main()
    {
    	
    	ios_base::sync_with_stdio(false); 
        	cin.tie(NULL); 
        string n;
	cin>>n;
	for(ll i=0;i<n.size();i++)
	{
		if(n[i]=='1')n[i]='9';
		else
			n[i]='1';
	}
    	cout<<n;
    }

Measured memory_bytes: 256
package main

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

func main() {
	s := strings.Split(readString(), "")
	result := 0
	Loop(0, len(s), func(i int) {
		t := len(s) - i - 1
		if i >= t {
			return
		}

		if s[i] != s[t] {
			result++
		}
	})

	fmt.Println(result)
}

/////////////////////////////////////////
var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
	//scanner.Split(bufio.ScanLines)
}

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	return t
}

func Loop(start, end int, f func(i int)) {
	for i := start; i < end; i++ {
		f(i)
	}
}

Measured memory_bytes: 640
x,y,z,k = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
b = sorted(list(map(int,input().split())),reverse=True)
c = sorted(list(map(int,input().split())),reverse=True)

r = []
for i in range(x):
  for j in range(y):
    for h in range(z):
      if (i+1)*(j+1)*(h+1) > k:
                break
      r.append(a[i]+b[j]+c[h])
list.sort(r,reverse=True)
for i in range(k):
  print(r[i])

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

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;

void solve()
{   
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = a * (n / (a + b));
    ans += min(a, n % (a + b));

    cout << ans << '\n';
} 

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

    // int t; cin >> t; while (t--)
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRF(f) printf("%lf\n",f)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
int main(){
  int n,a,sum=0,x=100;
  scanf("%d",&n);
  FOR(n){
    scanf("%d",&a);
    sum+=a;
    if(a<x&&a%10)x=a;
  }
  if(x>99)x=sum;
  if(sum%10<1)sum-=x;
  PRN(sum);
  return 0;
}

Measured memory_bytes: 128
n = int(input())

cards = [[False for i in range(13)] for j in range(4)]

for i in range(n):
    n,m = input().split()
    m = int(m)
    if n == 'S':
        cards[0][m-1] = True
    elif n == 'H':
        cards[1][m-1] = True
    elif n == 'C':
        cards[2][m-1] = True
    elif n == 'D':
        cards[3][m-1] = True
for j in range(4):
    for i in range(13):
        if cards[j][i] == False:
            if j == 0:
                print('S ' + str(i+1))
            elif j == 1:
                print('H ' + str(i+1))
            elif j == 2:
                print('C ' + str(i+1))
            elif j == 3:
                print('D ' + str(i+1))

Measured memory_bytes: 7764
import Control.Applicative
main :: IO ()
main = do
    [a, b] <- map (read :: String -> Int) . words <$> getLine
    
    if a==b
        then putStrLn "Draw"
        else if b/=1 && ( a==1 || a>b)
                then putStrLn "Alice"
                else putStrLn "Bob"

Measured memory_bytes: 508
use strict;
use warnings;

my $n = <>;
chomp($n);

my $digit = ($n =~ tr/[0-9]/[0-9]/);
my $r = 0;

for my $i (1 .. $digit){
	next if($i % 2 == 0);
	my $s = 10 ** ($i - 1);
	$s = 1 if($s == 0);
	my $e = (10 ** $i) - 1;
	$e = $n if($i == $digit);
	$r += ($e - $s + 1);
}

print $r;


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

const int MaxN = 100000;
long long S[ MaxN + 10 ];

int main()
{
long long i;
long long N;
long long M;
long long A;
long long x;
long long iCnt;
long long iSum;

	scanf( "%lld %lld", &N, &M );

	iSum = 0;
	iCnt = 0;
	for( i = 1; i <= N; i++ )
	{
		scanf( "%lld", &A );

		iSum += A;
		iSum %= M;
		S[ i ] = iSum;
	}

	sort( S, S + ( N + 1 ) );

	x = 0;
	for( i = 1; i <= N; i++ )
	{
		if( S[ i - 1 ] == S[ i ] )
			x++;
		else
		{
			iCnt += ( x + 1 ) * x / 2;
			x = 0;
		}
	}

	if( x > 0 ) iCnt += ( x + 1 ) * x / 2;

	printf( "%lld\n", iCnt );

	return 0;
}






Measured memory_bytes: 1024
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	int N,W;
	std::cin >> N >> W;
	std::vector<int> dp(W+1,0);
	rep(i,N) {
		int w,v;
		std::cin >> w >> v;
		for(int j = W;j>=0;j--) {
			if(j-w>=0) dp[j] = std::max(dp[j],dp[j-w]+v);
		}
	}
	print(dp[W]);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;

int main()
{
    string s;
    string alp = "abcdefghijklmnopqrstuvwxyz";

    cin >> s;

    bool ans = true;
    if (s[0] == 'A')
    {
        int cnt = 0;
        for (int i = 2; i < s.size() - 1; i++)
        {
            if (s[i] == 'C')
                cnt++;
        }
        if (cnt != 1)
            ans = false;
        else
        {
            for (int i = 1; i < s.size(); i++)
            {
                if (s[i] == 'C')
                    continue;

                bool h = false;
                REP(j, 26)
                {
                    if (s[i] == alp[j])
                        h = true;
                }

                if (!h)
                    ans = false;
            }
        }
    }
    else
        ans = false;

    cout << (ans ? "AC" : "WA") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
	typedef long long int ll; 
     
    int main() { 
      
      int m=10;      
      int S=0;
      
      for(int i=0; i<5; i++){
        int A;
        cin>> A;
        if(A%10==0){
          S+=A;
        }else{
          S= S + (A/10)*10 + 10; 
          m = min(m , A%10 ); 
        }
      }
      
     
        cout<< S-10+m << endl;
           
    }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

using namespace std;

template<class T, size_t N, class F>
struct compare_n
{
    F f;
    bool operator() (const T& t1, const T& t2)
    {
        return f(get<N>(t1), get<N>(t2));
    }
};
 
template<size_t N, class T>
auto make_less_n(const T&)
{
    using t = typename T::value_type;
    using less = std::less<typename tuple_element<N, t>::type>;
    return compare_n<t, N, less>();
}



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

    string s;
    cin >> s;
    
    int a = numeric_limits<int>::max();
    
    for(auto i : irange(size_t(0), s.size()-2))
    {
        a = min(abs(stoi(s.substr(i, 3)) - 753), a);
    }
    cout << a << '\n';

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

struct edge{
	int to;
	int cost;
};

vector<edge> g[114514];

void add_edge(int from, int to, int cost){
	g[from].push_back({to, cost});
	return;
}

int ans[114514];

void dfs(int s){
	for(auto x : g[s]){
		if(ans[x.to]!=-1){
			continue;
		}
		if(x.cost&1){
			if(ans[s]){
				ans[x.to]=0;
			}
			else{
				ans[x.to]=1;
			}
			dfs(x.to);
		}
		else{
			if(ans[s]){
				ans[x.to]=1;
			}
			else{
				ans[x.to]=0;
			}
			dfs(x.to);
		}
	}
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, u, v, w;
	cin>>n;
	REP(i, n-1){
		cin>>u>>v>>w;
		--u;
		--v;
		add_edge(u, v, w);
		add_edge(v, u, w);
	}
	REP(i, n){
		ans[i]=-1;
	}
	ans[0]=0;
	dfs(0);
	REP(i, n){
		cout<<ans[i]<<'\n';
	}
	return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int M = 51;
		long Inf = 1L << 53;
		long[][] WF = new long[M][];
		for(int i=0;i<M;i++){
			WF[i] = new long[M];
			for(int j=0;j<M;j++){
				WF[i][j] = i == j ? 0 : Inf;
			}
		}
		
		for(int i=0;i<M;i++){
			for(int j=1;j<M;j++){
				WF[i][i % j] = Math.Min(WF[i][i % j] , 1L << j);
			}
		}
		
		for(int k=0;k<M;k++){
			for(int i=0;i<M;i++){
				for(int j=0;j<M;j++){
					WF[i][j] = Math.Min(WF[i][j], WF[i][k] + WF[k][j]);
				}
			}
		}
		
		for(int i=0;i<N;i++){
			if(WF[A[i]][B[i]] == Inf){
				Console.WriteLine(-1);
				return;
			}
		}
		
		List<int> ans = new List<int>();
		for(int b=50;b>=1;b--){
			WF = new long[M][];
			for(int i=0;i<M;i++){
				WF[i] = new long[M];
				for(int j=0;j<M;j++) WF[i][j] = i == j ? 0 : Inf;
			}
			
			foreach(var j in ans){
				for(int i=1;i<M;i++){
					WF[i][i % j] = Math.Min(WF[i][i % j] , 1L << j);
				}
			}
			for(int j=b-1;j>=1;j--){
				for(int i=1;i<M;i++){
					WF[i][i % j] = Math.Min(WF[i][i % j] , 1L << j);
				}
			}
			for(int k=0;k<M;k++){
				for(int i=0;i<M;i++){
					for(int j=0;j<M;j++){
						WF[i][j] = Math.Min(WF[i][j], WF[i][k] + WF[k][j]);
					}
				}
			}
			
			bool unreach = false;
			for(int i=0;i<N;i++){
				if(WF[A[i]][B[i]] == Inf){
					unreach = true;
				}
			}
			if(unreach) ans.Add(b);
		}
		
		long tot = 0;
		foreach(var n in ans) tot += 1L << n;
		Console.WriteLine(tot);
		
		
	}
	int N;
	int[] A;
	int[] B;
	public Sol(){
		N = ri();
		A = ria();
		B = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13524
#include <iostream>

using namespace std;

void Solution()
{
    int n;  // period or cycle or term
    int input; // every element
    
    long sum;
    long max; // the biggest value
    
    while(cin>>n, n != 0)
    {
        cin >> input; // the first number of sequence
        
        max = sum = input;
        
        for(int i = 0; i < n - 1; i++)
        {
            cin >> input;
           
            if(sum < 0) // judge based on the first number of sequence
            {
                sum = input;
            }
            else
            {
                sum += input;
            }
            
            if(sum > max)
            {
                max = sum;
            }
        }
        
        cout<<max<<endl;
    }
}

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

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

int main() {
	string s, t, ans="";
	cin >> s >> t;
	for(int i=0;i<s.size();i++){
		bool ok = true;
		for(int j=0;j<t.size();j++){
			if(s[i+j]!=t[j] && s[i+j] != '?' || i+j>=s.size()){
				ok = false;
				break;
			}
		}
		if(ok == true){
			ans = s;
			for(int j=0;j<t.size();j++){
				ans[i+j] = t[j];
			}
			for(int j=0;j<s.size();j++){
				if(ans[j]=='?'){
					ans[j] = 'a';
				}
			}
		}
	}
	if(ans.size()>0){
		cout << ans << endl;
	}
	else{
		cout << "UNRESTORABLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val h = sc.nextInt()
    println((a + b) * h / 2)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 34252
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int n, k;
	cin >> n >> k;
	if ((n + 1) / 2 >= k) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}
}

Measured memory_bytes: 892
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk;

  vector<int> a,a2;
  vector<int> prev;
  int n;

  cin >> n;

  a.resize(n);
  a2.resize(n);
  prev.resize(n);
  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }

  copy(a.begin(),a.end(),a2.begin());

  sort(a2.begin(),a2.end());
  bool flg;
  do{
    flg = false;

    for(ii=0;ii<n;ii++){
      if(a[ii] != a2[ii]){
        break;
      }
    }
    if(ii == n){
      break;
    }
    
    //for(auto val :a2){
    //  cout << val << " " ;
    //}
    //cout << endl;
    
    copy(a2.begin(),a2.end(),prev.begin());
    
  }while(next_permutation(a2.begin(),a2.end()));

  if(prev[0] != 0){

    for(ii=0;ii<n;ii++){
      cout << prev[ii];
      if(ii != n-1){
        cout << " ";
      }
      else{
        cout << endl;
      }
    }
    
  }
  for(ii=0;ii<n;ii++){
    cout << a[ii];
    if(ii != n-1){
      cout << " ";
    }
    else{
      cout << endl;
    }
  }

  if(next_permutation(a2.begin(),a2.end())){
    for(ii=0;ii<n;ii++){
      cout << a2[ii];
      if(ii != n-1){
        cout << " ";
      }
      else{
        cout << endl;
      }    
    }
  }
  
  return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100010
int a[N], n;
ll ans;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        if (a[i] && a[i - 1]) a[i]--, ans++;
        ans += (a[i] >> 1), a[i] &= 1;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#define int long long
#define mod 1000000007
using namespace std;
int n; vector<int>v;
map<int, int>m;
set<int>s;
int find(int a, int b) {
	//a xor x = b
	int r = 0, p = 1;
	while (a + b > 0) {
		r += p * (a % 2 != b % 2);
		p *= 2; a /= 2; b /= 2;
	}
	return r;
}
bool f(int k) {
	map<int, int>m1 = m;
	int x, y, z;
	x = v[0], y = v[k];
	m1[x]--; m1[y]--;
	for (int i = 2; i < n; i++) {
		z = find(x, y);
		if (*lower_bound(v.begin(), v.end(), z) == z) {
			m1[z]--;
			if (m1[z] < 0)return 0;
		}
		else return 0;
		x = y; y = z;
	}
	return find(x, y) == v[0];
}
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int a; cin >> a;
		v.push_back(a);
		s.insert(a);
	}
	if (s.size() > 3) {
		cout << "No\n";
		return 0;
	}
	sort(v.begin(), v.end());
	m[v[0]] = 1;
	for (int i = 1; i < v.size(); i++) {
		if (v[i] == v[i - 1])m[v[i]]++;
		else m[v[i]] = 1;
	}
	for (int i = 1; i < n; i++) {
		if (i >= 2 && v[i] == v[i - 1])continue;
		if (f(i)) {
			cout << "Yes\n"; return 0;
		}
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 4468
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){

	int ch;
	int num[26] = {0};
	//while(ch=getchar()){
	while(ch=getchar()){
		if(ch == EOF){break;}
		else if (!(ch == 32 || ch == 33 || ch == 46 || ch == 63)){
			(ch>=97 && ch<= 122) ? ++num[ch-97]: ++num[ch-65];
		}
	}

	for(int i=0; i<26; ++i){
		cout << (char)(97+i) << " : " << num[i] << endl; 
	}
	return 0;
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
   ll n,i;
   cin>>n;
   string s1,s2;
   cin>>s1>>s2;
   for(i=0;i<n;i++)
   {
       cout<<s1[i]<<s2[i];
   }
}


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

int main() {
  int n,a[101],count=0;
  cin>>n;
  rep(i,n) cin >> a[i];
 for(int i=0;i<n-2;i++){
   for(int j=i+1;j<n-1;j++){
     for(int k=j+1;k<n;k++){
       if((a[i]+a[j])>a[k]&(a[j]+a[k])>a[i]&(a[k]+a[i])>a[j]&a[i]!=a[j]&a[j]!=a[k]&a[k]!=a[i]){
         count++;
       }
     }
   }
 }
  cout<<count<<endl;
}
  
  

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

int main(){
    int n, q; string s;
    cin >> n >> s >> q;

    for(int i=0; i<q; i++){
        int k;
        cin >> k;

        long long int d = 0, m = 0, dm = 0, ans = 0;
        for(int i=0; i<n; i++){
            if(s[i] == 'D') d += 1;
            if(s[i] == 'M'){ m += 1; dm += d; }

            if(i >= k){
                if(s[i-k] == 'D'){ d -= 1; dm -= m; }
                if(s[i-k] == 'M') m -= 1;
            }

            if(s[i] == 'C') ans += dm;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int ketasu(long X) {
    int cnt = 0;
    while (X > 0) {
        X /= 10;
        cnt++;
    }
    return cnt;
}

int main() {
    long N;
    cin >> N;
    // cout << sqrt(N) << endl;

    int v, minv = 100;
    for (long A = 1; A <= sqrt(N) + 1; A++)
    {
        /* code */
        // cout << A << endl;
        if (N % A != 0)
            continue;
        // cout << A << endl;
        long B = N / A;
        // cout << A << " " << B << endl;
        // cout << ketasu(A) << " " << ketasu(B) << endl;
        v = max(ketasu(A), ketasu(B));
        // cout << A << " " << B << " " << v << endl;
        minv = min(minv, v);
    }

    cout << minv << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793
template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
/*
 * UnionFind。O(ｱｯｶｰﾏﾝ)
 */
struct UnionFind{
	vi p;
	UnionFind(int s):p(s,-1){}
	void unite(int a,int b){
		a=root(a);b=root(b);
		if(a!=b){
			if(p[b]<p[a])swap(a,b);
			p[a]+=p[b];p[b]=a;
		}
	}
	bool same(int a,int b){return root(a)==root(b);}
	int root(int a){return p[a]<0?a:p[a]=root(p[a]);}
};

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n;
   	cin>>n;
   	using D=tuple<int,int,int>;
   	vector<D> data;
   	
   	rep(i,n){
   	    int x,y;
   	    cin>>x>>y;
   	    data.emplace_back(i,x,y);
   	}
   	vector<D> edge;
   	sort(all(data),[](D a,D b){return get<1>(a)<get<1>(b);});
   	rep(i,n-1){
   	    int a0,a1,a2,b0,b1,b2;
   	    tie(a0,a1,a2)=data[i];
   	    tie(b0,b1,b2)=data[i+1];
   	    edge.emplace_back(b1-a1,a0,b0);
   	}
   	sort(all(data),[](D a,D b){return get<2>(a)<get<2>(b);});
   	rep(i,n-1){
   	    int a0,a1,a2,b0,b1,b2;
   	    tie(a0,a1,a2)=data[i];
   	    tie(b0,b1,b2)=data[i+1];
   	    edge.emplace_back(b2-a2,a0,b0);
   	}
   	int ans=0;
   	UnionFind uf(n);
   	sort(all(edge),[](D a,D b){return get<0>(a)<get<0>(b);});
   	for(auto&e:edge){
   	    int c,a,b;
   	    tie(c,a,b)=e;
   	    if(uf.same(a,b))continue;
   	    uf.unite(a,b);
   	    ans+=c;
   	}
   	cout<<ans<<endl;
}


Measured memory_bytes: 6132
n,y=map(int,input().split())
p=False
for i in range(n+1):
    for j in range(n-i+1):
        if y == 10000*i+5000*j+1000*(n-i-j) and -1<n-i-j:
            print(i,j,n-i-j)
            p=True
            break
    if p:
        break
if not p:
    print(-1,-1,-1)

Measured memory_bytes: 3060
//सत्यान्न प्रमदितव्यम्  ||
//Still, Taking my time to perfect the beats
//And I still got love for the streets, it's the A-D-D-U

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define nt _int128
#define fir first
#define sec second
#define fast_as_levi ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debugged cout<<"debugged\n";
#define inf 0x3f3f3f3f
#define LINF  0x3f3f3f3f3f3f3f3fll
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end() 

const ll mod = 999983;
#define mx 1000005
const ll mxi = 10005;

int main()
{
    fast_as_levi;
    string s;
    cin>>s;
    if(s[1]=='R')
    {
        cout<<"ABC";
    }
    else cout<<"ARC";
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstring>

using namespace std;

int paper[500][500];

int main() {
	int n, m, t, p; 
	while (cin >> n >> m >> t >> p, n) {
		int dx = 0, dy = 0;
		memset(paper, 0, sizeof(paper));
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < m; ++j)
				paper[i][j] = 1;
		while (t--) {
			int d, c; cin >> d >> c;
			if (d == 1) {
				for (int i = 0; i < c; ++i)
					for (int j = dy; j < m; ++j)
						paper[dx + c + i][j] += paper[dx + c - i - 1][j];
				dx += c;
				if (n < dx + 2 * c) n = dx + 2 * c;
			} else {
				for (int i = 0; i < c; ++i)
					for (int j = dx; j < n; ++j)
						paper[j][dy + c + i] += paper[j][dy + c - i - 1];
				dy += c;
				if (m < dy + 2 * c) m = dy + 2 * c;
			}
		}
		while (p--) {
			int x, y; cin >> x >> y;
			cout << paper[dx + x][dy + y] << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

bool p[3000000];
vector<int> prime;

void init(){
    memset(p,1,sizeof(p));
    p[0] = p[1] = false;
    for(int i = 2; i <= 1000000; i++){
        if(!p[i]) continue;
        for(long long j = 1LL*i*i; j <= 1000000; j += i)
            p[j] = false;
        prime.push_back(i);
    }
}

int CntPrime(int n){
    //vector<int>::iterator it = lower_bound(prime.begin(), prime.end(), n);
    //if( *it > n) it--;
    //return (it - prime.begin() + 1);
    int res = 0;
    for(int i = 0; i < prime.size(); i++){
        if(prime[i] <= n) res++;
        else break;
    }
    return res;
}

int main(){
    init();
    int n;
    while(cin >> n){
        cout << CntPrime(n)<< endl;
    }
    return 0;
}

Measured memory_bytes: 6196