akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=10,INF=1<<29;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    while(1){
        int N,M;cin>>N>>M;
        vector<pair<int,int>> when(N);
        for(int i=0;i<N;i++) when[i].first=i+1;
        
        for(int i=0;i<M;i++){
            int a;cin>>a;
            a--;
            when[a].second=i+1;
        }
        
        sort(all(when),[](pair<int,int> a,pair<int,int> b){
            if(a.second==b.second) return a.first<b.first;
            return a.second>b.second;
        });
        
        for(int i=0;i<N;i++) cout<<when[i].first<<endl;
        
        break;
    }
}



Measured memory_bytes: 4436
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int main() {
  string s;
  cin >> s;
  bool result = false;
  for (int i = 0; i + 1 < (int)s.size(); ++i)
    if (s[i] == 'A' && s[i + 1] == 'C') {
      result = true;
      break;
    }
  if (result) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 100000;

void swap(int *x, int *y) {
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

int partition(int A[], int p, int r) {
    int x = A[r];
    int i = p - 1;
    int temp;

    for (int j = p; j < r; j++) {
        if (A[j] <= x) {
            i++;
            temp = A[j];
            A[j] = A[i];
            A[i] = temp;
        }
    }

    temp = A[i + 1];
    A[i + 1] = A[r];
    A[r] = temp;

    return i + 1;
}

int main () {
    int n;
    int A[MAX_N];

    cin >> n;

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

    int q = partition(A, 0, n - 1);

    for (int i = 0; i < n; i++) {
        if (i) {
            cout << " ";
        }

        if (i == q) {
            cout << "[";
        }
        cout << A[i];
        if (i == q) {
            cout << "]";
        }
    }

    cout << endl;
}

Measured memory_bytes: 3456
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <list>
#include <map>
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)
#define forall(it,p) for (auto it = p.begin(); it != p.end(); ++it)
#define DBG 1

#define MAXN 3001
int a[MAXN];
long b[MAXN][MAXN][2];

int main() {
  int n;
  cin >> n;
  forr(i,0,n-1)
    cin >> a[i];
  forr(i,0,n-1) {
    b[i][i][0] = a[i];
    b[i][i][1] = -a[i];
  }
  forr(d,1,n-1)
    forr(i,0,n-1-d) {
      int j = i+d;
      b[i][j][0] = max( a[i]+b[i+1][j][1], b[i][j-1][1]+a[j]);
      b[i][j][1] = min(-a[i]+b[i+1][j][0], b[i][j-1][0]-a[j]);
    }
  cout << b[0][n-1][0];

}


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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;

template<typename T> vector<vector<T> > doubling(vector<T> vec, int depth) {
  int s = (int) vec.size();
  int vs = 1;
  while (1 << vs <= depth) vs++;
  vector<vector<T> > tbl(vs, vector<T>(s));
  for (int j = 0; j < s; j++) tbl[0][j] = vec[j];
  for (int i = 1; i < vs; i++) {
    for (int j = 0; j < s; j++) {
      tbl[i][j] = tbl[i - 1][tbl[i - 1][j]];
    }
  }
  return tbl;
}

void Main() {
  int N, K;
  scanf("%d%d", &N, &K);

  vi P(N);
  vi D(N);
  vvi E(N);

  rep(i, N) {
    scanf("%d", &P[i]);
    P[i]--;
    if (i) E[P[i]].push_back(i);
  }

  int ans = 0;
  if (P[0] != 0) {
    P[0] = 0;
    ans++;
  }

  D[0] = 0;
  function<void(int)> dfs1 = [&](int cur) {
    forr(nex, E[cur]) {
      D[nex] = D[cur] + 1;
      dfs1(nex);
    }
  };
  dfs1(0);

  vpii F(N);
  rep(i, N) {
    F[i].fst = D[i];
    F[i].snd = i;
  }
  sort(ALL(F), greater<pii>());

  vvi table = doubling(P, K);

  vb done(N);
  function<void(int)> dfs2 = [&](int cur) {
    if (done[cur]) return;
    done[cur] = 1;
    forr(nex, E[cur]) {
      dfs2(nex);
    }
  };

  rep(i, N) {
    int v = F[i].snd;
    if (done[v]) continue;
    rep(k, SZ(table)) {
      if ((K-1) & BIT(k)) {
        v = table[k][v];
      }
    }
    if (P[v] != 0) {
      ans++;
      dfs2(v);
    }
  }
  _p("%d\n", ans);
}
int main() { cin.tie(0); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 24064
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
using namespace std;
#define INF 1010101010
#define MOD 1000000007
#define LL long long

long long rec(const string& s, int i, long long t, long long sum) {
    if (s.size() == i) return t + sum;
    return rec(s, i+1, t*10+(s[i]-'0'), sum) + rec(s, i+1, 0, sum+t);
}

int main() {
    string s;
    cin >> s;
    cout << rec(s, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
  int ans = 0;
  int maxi = 0;
  for(int i = 1; i <= 5; i++) {
    int a;
    cin >> a;
    if(a % 10) chmax(maxi, 10 - (a % 10));
    ans += (a + 9) / 10 * 10;
  }
  cout << ans - maxi << endl;
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int n;
    cin>>n>>s;
    for(int i=0;i<s.length();i++){
        s[i]+=n;
        if(s[i]>'Z') s[i]-=26;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ull mod = 1e9+7;
constexpr int N = 13;
ull dp[100010][N];

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int r;
	cin >> r;
	cout << 3 * myPower(r, 2) << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

f = lambda x:t-x*0.006

tmp = list(map(f,h))

MIN = 500000000000000000000
idx = 0

for i in range(len(tmp)):
    if abs(tmp[i]-a)<MIN:
        MIN = abs(tmp[i]-a)
        idx = i+1

print(idx)

Measured memory_bytes: 3064
A, B = map(int,input().split())

# K以下の排他的論理和(K < 0 では 0を返す)
def solve(K):
    if K <= 3:
        ans = 0
        for i in range(K+1):
            ans ^= i
        return ans
    ans = ((K+1) // 2) % 2
    if K % 2 == 0:
        ans ^= K
    return ans
print(solve(A-1) ^ solve(B))

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef stringstream SS;
template < typename T > inline T fromString( const string &s ){ T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

#include <complex>
typedef complex<double> Point;
const double EPS = 1e-8;
const double PI = acos( -1 );

// 入力ストリームから実数二つをとって Point へ
istream& operator >> ( istream &s, Point &a )
{
	double r, i;
	s >> r >> i;
	a = Point( r, i );
	return s;
}

// 多角形 ps の面積
double polygon_area( vector<Point> ps )
{
	const int N = ps.size();
	ps.push_back( ps[0] );

	double res = 0;
	for ( int i = 0; i < N; ++i )
	{
		res += ps[i].real() * ps[ i + 1 ].imag() - ps[ i + 1 ].real() * ps[i].imag();
	}
	return abs( res / 2 );
}

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

	vector< Point > ps;
	for ( string s; cin >> s; )
	{
		replace( ALL( s ), ',', ' ' );
		SS iss( s );
		Point p;
		iss >> p;
		ps.PB( p );
	}

	cout << setprecision( 8 ) << fixed << polygon_area( ps ) << endl;

	return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)


void Main() {
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  int s = 0;
  rep(i, n) s += A[i];
  int x = (s-1) / 4 / m +1;
  int ans = 0;
  rep(i, n) if (A[i] >= x) ans++;
  if (ans >= m) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const char ch[] = {"ULDR"};

bool g[10][10][10][10];

int main()
{
	char c;
	
	for (int i = 1; i <= 5; i++){
		for (int j = 1; j <= 4; j++){
			scanf(" %c", &c);
			if (c == '0') continue;
			g[i][j][i][j + 1] = true;
			g[i][j + 1][i][j] = true;
		}
		if (i == 5) continue;
		for (int j = 1; j <= 5; j++){
			scanf(" %c", &c);
			if (c == '0') continue;
			g[i][j][i + 1][j] = true;
			g[i + 1][j][i][j] = true;
		}
	}
	
	int dir = 3;
	int x = 1, y = 2;
	while (true){
		printf("%c", ch[dir]);
		if (x == 1 && y == 1) break;
		for (int t = 1; t >= -2; t--){
			int nd = (dir + t + 4) % 4;
			int nx = x + dx[nd];
			int ny = y + dy[nd];
			if (g[x][y][nx][ny]){
				x = nx;
				y = ny;
				dir = nd;
				break;
			}
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const ll MAX_N = 2e5 + 10, ALPH = 30;
ll nxt[MAX_N][ALPH];

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    string a, b;
    cin >> a >> b;
    ll n = a.size(), m = b.size();
    for(ll i = 0; i < n; i ++) {
        a += a[i];
    }
    for(ll j = 0; j < ALPH; j ++) {
        nxt[2 * n][j] = mod;
    }
    for(ll i = 2 * n - 1; i >= 0; i --) {
        for(ll j = 0; j < ALPH; j ++) {
            nxt[i][j] = nxt[i + 1][j];
        }
        nxt[i][a[i] - 'a'] = i;
    }
    ll curr = 0, ans = 0;
    for(ll i = 0; i < m; i ++) {
        curr = nxt[curr][b[i] - 'a'] + 1;
        if(curr == mod + 1) {
            cout << -1 << endl;
            return 0;
        }
        ans += curr / n;
        curr %= n;
    }
    cout << curr + ans * n << endl;
    return 0;
}




Measured memory_bytes: 47616
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,k,i;

cin>>n>>k;
long long a[n+1];
for(i=0;i<n;i++){
cin>>a[i];}
sort(a,a+n);
long long s=0;
for(i=0;i<k;i++){
    s=s+a[i];
}
cout<<s<<endl;
return 0;}


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

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

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

int dp[3005][3005];

int main() {
	int n, t, s;
	cin >> n >> t >> s;

	vector<P> v(n);
	rep(i, n) {
		cin >> v[i].first >> v[i].second;
	}

	memset(dp, 0, sizeof(dp));

	REP(i, 0, n) {
		rep(j, t + 1) {
			if(j - v[i].second < 0 || (j - v[i].second < s && s < j) ) {
				dp[i+1][j] = dp[i][j];
			} else {
				dp[i+1][j] = max(dp[i][j], dp[i][j-v[i].second] + v[i].first);
			}
		}
	}

	int ans = 0;
	rep(i, n + 1 ) {
		rep(j, t + 1) {
			ans = max(ans, dp[i][j]);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 36500
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var min = 30;
            // log_2(10^9) = 29.89
            var N = cin.ReadInt;
            for (int i = 0; i < N; i++)
            {
                var A = cin.ReadInt;
                var c = 0;
                while (A % 2 ==0 && A != 0)
                {
                    A >>= 1;
                    c++;
                }
                min = Min(min, c);
            }
            WriteLine(min);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long

int main() {
  int A,B,H,M;
  cin >> A >> B >> H >> M;
  double dist = 0.0;
  double theta_A = 30*H+0.5*M;
  double theta_B = 6*M;
  dist = sqrt(A*A+B*B-2*A*B*cos((theta_A-theta_B)*M_PI/180.0));
  cout << std::setprecision(12) << dist << endl;
}

Measured memory_bytes: 4224
interface Operator {
    fun execute(left: Int, right: Int): Int
    fun str(): String
}

class Plus() : Operator {
    override fun execute(left: Int, right: Int): Int {
        return left + right
    }

    override fun str(): String {return "+"}
}

class Minus() : Operator {
    override fun execute(left: Int, right: Int): Int {
        return left - right
    }

    override fun str(): String {return "-"}
}

fun main(args: Array<String>) {
    val (a: Int, b: Int, c: Int, d: Int) = readLine()!!.trim().map {it.toString().toInt()}

    val operators = listOf<Operator>(Plus(), Minus())
    operators.forEach { op1 ->
        operators.forEach { op2 ->
            operators.forEach { op3 ->
                if (isEqualTo7(a, b, c, d, op1, op2, op3)) {
                    val result: String = formatSiki(a, b, c, d, op1, op2, op3)
                    println(result)
                    return
                }
            }
        }
    }
}

fun formatSiki(a: Int, b: Int, c: Int, d: Int, op1: Operator, op2: Operator, op3: Operator): String {
    return "${a}${op1.str()}${b}${op2.str()}${c}${op3.str()}${d}=7"
}

fun isEqualTo7(a: Int, b: Int, c: Int, d: Int, op1: Operator, op2: Operator, op3: Operator): Boolean {
    return op3.execute(op2.execute(op1.execute(a, b), c), d) == 7
}

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

int main ( )
{
    int VAR00 , VAR01 , VAR02 = 0 , VAR03 ;
    scanf ( "%d %d" , & VAR00 , & VAR01 ) ;
    int * VAR04 = malloc ( sizeof ( int ) * VAR00 ) ;
    for ( int VAR05 = 0 ; VAR05 < VAR00 ; VAR05 ++ ) {
        scanf ( "%d" , & VAR03 ) ;
        VAR02 += VAR03 ;
        VAR04 [ VAR05 ] = VAR03 ;
    }
    int VAR06 = 1 , VAR07 = VAR02 , VAR08 , VAR09 , VAR10 , VAR11 ;
    VAR08 = ( VAR06 + VAR07 ) / 2 ;

    while ( 1 )
    {


        VAR10 = VAR08 ;
        VAR11 = 0 ;
        VAR09 = 0 ;
        for ( int VAR12 = 0 ; VAR12 < VAR00 ; VAR12 ++ )
        {

            if ( VAR10 < VAR04 [ VAR12 ] )
            {

                VAR09 ++ ;
                VAR10 = VAR08 ;
                if ( VAR08 < VAR04 [ VAR12 ] ) {
                    VAR11 = 1 ;
                    break ;
                }
                else VAR10 -= VAR04 [ VAR12 ] ;
            } else
            {

                VAR10 -= VAR04 [ VAR12 ] ;
            }

            if ( VAR09 == VAR01 ) {
                VAR11 = 1 ;

                break ;
            }
        }
        if ( VAR06 == VAR07 ) break ;
        else {
            if ( VAR11 == 1 ) {
                VAR06 = VAR08 + 1 ;
            } else {
                VAR07 = VAR08 ;
            }
        }
        VAR08 = ( VAR07 + VAR06 ) / 2 ;

    }
    printf ( "%d\n" , VAR07 ) ;
}


Measured memory_bytes: 2252
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7'){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  vector<int64_t> cs(N+1);
  cs.at(0)=0;
  int64_t sum=0;
  for(int i=1;i<=N;i++){
    int64_t a;
    cin >> a;
    cs.at(i)=cs.at(i-1)+a;
    sum+=a;
  }
  priority_queue< int64_t,vector<int64_t>,greater<int64_t> >pq;
  for(int i=1;i<N;i++){
    pq.push(abs(sum-2*cs.at(i)));
  }
  cout << pq.top() << endl;
  return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;

#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)

#define STRESS 0
using lint = long long;

bool one_let(string& s) {
    for (int i = 1; i < s.size(); i++) {
        if (s[i] != s[0]) {
            return false;
        }
    }
    return true;
}

bool has(string& s, char c) {
    for (char q : s) {
        if (q == c) {
            return true;
        }
    }
    return false;
}

void solve(istream& cin, ostream& cout) {
    int ans = 1e9;
    string s;
    cin >> s;
    for (char c = 'a'; c <= 'z'; c++) {
        if (!has(s, c)) {
            continue;
        }
        string a = s;
        int st = 0;
        while (!one_let(a)) {
            st++;
            string b;
            for (int i = 0; i + 1 < a.size(); i++) {
                if (a[i] == c || a[i + 1] == c) {
                    b.push_back(c);
                } else {
                    b.push_back(a[i]);
                }
            }
            a = b;
        }
        ans = min(ans, st);
    }
    cout << ans;
}

int main() {
#if !defined(JLOCAL) || !STRESS
#ifdef JLOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve(cin, cout);
#else
    srand();
    for (int ti = 0; ti < 100; ti++) {
        stress::gen();
        stress::stupid();
        ifstream in("input.txt");
        ofstream out("output.txt");
        solve(in, out);
        out.flush();
        stress::check();
    }
    cout << "ok" << endl;
#endif
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using lint=long long;
lint msb(lint x){
    x|=x>>1;x|=x>>2;x|=x>>4;
    x|=x>>8;x|=x>>16;x|=x>>32;
    return x^x>>1;
}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<lint>a(n);
    for(lint&x:a)std::cin>>x;
    lint all=std::accumulate(a.begin(),a.end(),0ll,std::bit_xor<>{});
    for(lint&x:a)x&=~all;
    for(lint i=0;i<n;i++){
        std::swap(a.at(i),*std::max_element(a.begin()+i,a.end()));
        if(!a.at(i))break;
        lint test=msb(a.at(i));
        for(lint j=0;j<n;j++){
            if(j==i||!(a.at(j)&test))continue;
            a.at(j)^=a.at(i);
        }
    }
    lint max=std::accumulate(a.begin(),a.end(),0ll,std::bit_xor<>{});
    std::cout<<(all^max)+max<<'\n';
}


Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) printf("%d\n",(x));
#define ENDL printf("\n");
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

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

signed main(){
    int r ; cin >> r;
    double PI = acos(-1);
    cout << fixed << 2 * PI * (double)r << endl;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
        
        
int main() {
        ll h,w;
        cin >> h >> w;
        if(h==1 ||w==1){
                cout << 1 << endl; 
                //return 0;
        }else{
         ll ans ;
        if(h%2 == 0 || w%2 == 0) ans = (h*w)/2;
        else ans = ((h-1)*w)/2 + (w/2)+1;
        cout << ans << endl;
        }
        
        return 0;
}




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

const int INF = 1001001001;

int main() {
  int a, b, c, k;
  cin>>a>>b>>c>>k;

  int multi = 0, tmp = 0;
  multi = max(a, b);
  tmp = min(a, b);
  int plus = tmp;

  tmp = min(multi, c);
  multi = max(multi, c);

  plus += tmp;

  int z = pow(2, k);
  multi = multi * z;

  int ans;
  ans = multi + plus;
  cout<<ans<<endl;


  return 0;
}

Measured memory_bytes: 256
import heapq

N = int(input())

q = []

for _ in range(N):
    s = input()
    ss = sorted(s)
    heapq.heappush(q, ss)



n = 1
last = ''
ans = 0

while q:
    v = heapq.heappop(q)
    if v == last:
        n += 1
    else:
       ans += n*(n-1) // 2
       n =1

    last = v

if n != 0:
    ans += n*(n-1) // 2
    

print(ans)

Measured memory_bytes: 24180
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll attacks(vector<ll> &v, ll n, ll k){
    if(n<k)
    return 0;
    sort(v.begin(),v.end());
    ll p = n-k,sum=0;
    for(int i=0;i<p;i++){
        sum+=v[i];
    }
    return sum;
}
int main() {
	ll n,k;
	cin>>n>>k;
	vector<ll> v(n);
	for(int i=0;i<n;i++){
	    cin>>v[i];
	}
	cout<<attacks(v, n, k);
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.lang.Math;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
  		
      	int n = sc.nextInt();
      	String s = sc.next();
      	String t = sc.next();
      	char chs[] = new char[2*n];
      	String st;
      
      	for(int i = 0;i < n;i++){
        	chs[2*i] = s.charAt(i);
          	chs[2*i+1] = t.charAt(i);
        }        
        st = new String(chs);  	
      	
      	System.out.println(st);
        
	}
}


Measured memory_bytes: 35708
# include <iostream>
# include <algorithm>
using namespace std;
const int N=100006;
long long p,q,s;
int a[N];
int n;
void work (void)
{
	int i;
	i=n-1;
	while (a[i]<a[i+1]&&i>=1)
	i--;
	p=a[i];
	i-=2;
	while (a[i]<a[i+1]&&i>=1)
	i--;
	q=a[i];
	s=p*q;
	cout<<s;
}
int main (void)
{
	int i;
	cin>>n;
	for (i=1;i<=n;i++)
	cin>>a[i];
	sort (a+1,a+n+1);
	work ();
	return 0; 
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
  
// #define int long long
#define pb push_back
#define print(Target) cout << Target << '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)

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

bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

struct INFO{
  int num;
  double t;
};

bool cmp(INFO lhs, INFO rhs)
{
  return (lhs.t < rhs.t);
}

signed main()
{
  ios::sync_with_stdio(false);
  vector<INFO> lose;

  REP(i, 3){
    vector<INFO> info;
    REP(j, 8){
      int num; double t;
      cin >> num >> t;
      info.pb((INFO){num, t});
    }
    sort(info.begin(), info.end(), cmp);
    REP(j, 2){
      cout << info[j].num << " " << info[j].t << '\n';
    }
    REPS(j, 2, 8){
      lose.pb(info[j]);
    }
  }
  sort(lose.begin(), lose.end(), cmp);
  REP(i, 2){
    cout << lose[i].num << " " << lose[i].t << '\n';
  }

  return (0);
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int a, b;
  cin >> a >> b;
  cout << max({a + b, a * b, a - b}) << endl;
}


Measured memory_bytes: 256
a = list(map(int, input().split()))
if a[0]>a[1]:
    a[0],a[1]=a[1],a[0]
if a[0]>a[2]:
    a[0],a[2]=a[2],a[0]
if a[1]>a[2]:
    a[2],a[1]=a[1],a[2]
print(*a)


Measured memory_bytes: 5596
import math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

s = readChar()

color = [[0,0],[0,0]]

for i in range(len(s)):
	if i%2==0:
		color[0][int(s[i])]+=1
	else:
		color[1][int(s[i])]+=1

print(min(color[0][0]+color[1][1],color[0][1]+color[1][0]))

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

signed main(){
  int K,N;
  cin>>K>>N;
  vector<int> A(N);
  rep(i,N)cin>>A[i];
  A.push_back(A[0]+K);
  int far=0;
  rep(i,N){
    far=max(far,A[i+1]-A[i]);
  }
  int ans=K-far;
  cout<<ans<<endl;
}

Measured memory_bytes: 4736
/**
 *    created by : PawPaw       
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  

using namespace __gnu_pbds;  
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define N 1000001
#define PB push_backvvvvvv
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key

int solve(){
  string s;
  int change = 0, i, j;
  cin >> s;
  i = 0, j = (int)s.size()-1;
  while(i < j){
    if(s[i] != s[j]) change++;
    i++, j--;
  }
  cout << change << '\n';
  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

Measured memory_bytes: 256
// AOJ 2251 Merry Christmas
// 2018.3.6 bal4u

#include <stdio.h>
#include <string.h>

#define MAX 2002
short hi[MAX], to[MAX][MAX];
char  seen[MAX];
short match[MAX];

int bpm(int u)
{
	int i, v;

	for (i = 0; i < hi[u]; i++) {
		v = to[u][i];
		if (seen[v]) continue;
		seen[v] = 1;
		if (match[v] < 0 || bpm(match[v])) {
			match[u] = v, match[v] = u;
			return 1;
		}
	}
	return 0;
}

#define INF 0x1010
int dist[102][102];
int p[1002], t[1002];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int main()
{
	int N, M, L, u, v, d, k;

	while (N = in()) {
		M = in(), L = in();
		memset(dist, INF, sizeof(dist));
		for (k = 0; k < N; k++) dist[k][k] = 0;
		for (k = 0; k < M; k++) {
			u = in(), v = in(), d = in();
			dist[u][v] = dist[v][u] = d;
		}
		for (k = 0; k < N; k++) {
			for (u = 0; u < N; u++) if (dist[u][k] != INF) {
				for (v = 0; v < N; v++) if (dist[k][v] != INF) {
					d = dist[u][k] + dist[k][v];
					if (dist[u][v] > d) dist[u][v] = d;
				}
			}
		}

		memset(hi, 0, sizeof(hi));
		for (k = 0; k < L; k++) p[k] = in(), t[k] = in();
		for (u = 0; u < L; u++) for (v = 0; v < L; v++) if (u != v) {
			if (dist[p[u]][p[v]] <= t[v]-t[u]) to[u][hi[u]++] = v+L;
		}

	    memset(match, -1, L << 2);
		k = L;
		for (u = 0; u < L; u++) {
			memset(seen, 0, L << 1);
			if (bpm(u)) k--;
		}
		printf("%d\n", k);
	}
	return 0;
}


Measured memory_bytes: 5652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll cnt[200020];
ll used[200020];

int main(){
  int n,d,a;
  cin >> n >> d >> a;
  pll p[n];
  d+=d;
  rep(i,n)cin >> p[i].first >> p[i].second;
  sort(p,p+n);
  ll ans=0;
  int left=0,right=0;
  ll sum=0;
  rep(i,n){
    while(left<n && p[left].first+d<p[i].first){
      used[left]=false;
      sum-=cnt[left]*a;
      left++;
    }
    /*
    while(right<n && p[right].first<p[i].first+d){
      used[right]=true;
      sum+=cnt[right]*a;
      right++;
    }
    */
    cnt[i]=(max(0LL,p[i].second-sum)+a-1)/a;
    ans+=cnt[i];
    sum+=cnt[i]*a;
///    cout << ans << endl;
//    cout << left << ' ' << right << ' ' << sum <<endl;
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 6528
(r, c) = [int(i) for i in input().split()]
 
ct = [0 for d in range(c)]
tmp = []
for rc in range(r):
    tmp = [int(i) for i in input().split()]
    total = 0
    for cc in range(c):
        ct[cc] += tmp[cc]
        total += tmp[cc]
        print(tmp[cc], end=' ')
    print(total)
total = sum(ct)
print(' '.join([str(i) for i in ct]), total)

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

#define REP(i,n) for(decltype(n) i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(c) ((int)((c).size()))
#define st first
#define nd second
#define pb push_back

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef long long ll;

void solve(){
    unsigned long long x,y;
    cin>>x>>y;
    int l=0;
    while(x<=y){
        ++l;
        x *= 2;
    }
    cout<<l;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}

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

struct data{
    int n, solve, pena;
    int w[11] = {};

    void init(int i){
        n = i;
        solve = 0;
        pena = 0;
    }

    void submit(int p, int t, string judge){
        if(judge == "CORRECT"){
            solve++;
            pena += w[p]*1200+t;
        }else if(judge == "WRONG"){
            w[p]++;
        }
    }

    bool operator< (const data other) const{
        if(solve != other.solve)    return solve > other.solve;
        if(pena != other.pena)      return pena < other.pena;
        return n < other.n;
    }

    void print(){
        cout << n << " " << solve << " " << pena << endl;
    }
};

int main(){
    int t, p, r;
    while(cin >> t >> p >> r, t+p+r){
        vector<data> v(t);
        for(int i = 0; i < t; i++)  v[i].init(i+1);

        int a, b, c;
        string s;

        for(int i = 0; i < r; i++){
            cin >> a >> b >> c >> s;
            v[--a].submit(b, c, s);
        }

        sort(v.begin(), v.end());

        for(data d : v) d.print();
    }
    return 0;
}


Measured memory_bytes: 3176
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([6, 7, 9, 10, 31]), 'APPROVED')

    def test_2(self):
        self.assertEqual(think([28, 27, 24]), 'DENIED')


def solve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a):
    approved = True
    for e in a:
        if e % 2 == 0:
            if e % 3 == 0 or e % 5 == 0:
                continue
            else:
                approved = False
                break
        else:
            continue
    return 'APPROVED' if approved else 'DENIED'


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 49904
from sys import stdin
import math

N = int(input())
xy = []
for _ in range(N):
    xy.append(list( map(int,input().split())))

sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum += math.sqrt((xy[i][0] - xy[j][0])**2 + (xy[i][1] - xy[j][1])**2)

print(sum * 2 / N)

Measured memory_bytes: 3064
import sys

def main(inp_list):
    #print(inp_list)
    A, B, C, D = map(int, inp_list)
    return min(A, B) + min(C, D)

def init(MODE):
    arr = []
    if MODE == 0:
        while True:
            try:
                arr.append(int(input()))
            except:
                break
        return arr

if __name__ == '__main__':
    """ MODE: 0 縦, 1 縦横, 2 横 """
    MODE = 0
    inp_list = init(MODE)
    print(main(inp_list))


Measured memory_bytes: 2940
#include <stdio.h>
#include <limits.h>
typedef unsigned int uint;

inline static uint gl(void){
    uint x = 0;
    for(;;){
        const uint c = getchar_unlocked() - 48;
        if(c < 10){
            x = x*10 + c;
        }else{
            break;
        }
    }
    return x;
}

uint v[200000];
int main(void){
    const uint h = gl();
    gl();
    const uint n = gl();
    for(uint i=0; i<h; i++){ v[i] = i+1; }
    for(uint i=0; i<n; i++){
        uint x = gl()-1;
        uint y = gl()-1;
        v[x] = y<v[x] ? y : v[x];
    }
    uint right = 0;
    for(uint x=1; x<h; x++){
        if(v[x]<right+1){
            printf("%d\n", x);
            return 0;
        }else if(v[x]>right+1){
            right++;
        }
    }
    printf("%d\n", h);
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)


template<typename T>
struct MP {
  int n;
  T t;
  std::vector<int> a;
  MP() {}
  MP(const T& t): t(t) {
    n = t.size();
    a = std::vector<int>(n+1);
    a[0] = -1;
    int j = -1;
    for (int i = 0; i < n; ++i) {
      while (j != -1 && t[j] != t[i]) j = a[j];
      j++;
      a[i+1] = j;
    }
  }
  int operator[](int i) { return a[i];}
  std::vector<int> findAll(const T& s) {
    vector<int> res;
    int j = 0;
    for (int i = 0; i < s.size(); ++i) {
      while (j != -1 && t[j] != s[i]) j = a[j];
      j++;
      if (j == n) {
        res.push_back(i-j+1);
        j = a[j];
      }
    }
    return res;
  }
};

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;

void solve(){
  int n; string s; cin >> n >> s;
  int nl = 0, nr = n/2 + 1, nm;
  while(nr-nl>1){
    nm = (nl+nr)/2;
    bool psbl = false;
    FOR(i,0,n-nm){
      MP<string> mp( s.substr(i,nm) );
      vector<int> tbl = mp.findAll( s.substr(i+nm,n-nm-i) );
      if(!tbl.empty()){
        //sa = s.substr(i,nm);
        psbl = true;
        break;
      }
    }
    if(psbl) nl = nm;
    else nr = nm;
  }
  //if(sa.empty()) sa = sb;
  cout << nl << '\n';
}

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

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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}


int main() {
  int n;
  int ans=0;
  cin>>n;
  rep2(i,1,n+1){
    ans+=i;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import Control.Monad

main :: IO()
main = do
    n <- readLn
    ss <- replicateM n getLine
    print $ solve ss
        where
            solve ss = m*a*(r+c+h) + (m+a)*(r*(c+h) + c*h) + r*c*h
                where
                    m = count 'M' hs
                    a = count 'A' hs
                    r = count 'R' hs
                    c = count 'C' hs
                    h = count 'H' hs
                    hs = map head ss
                    count c s = length $ filter (== c) s


Measured memory_bytes: 48508
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/

const int MOD=1000000007;/* 1,000,000,007 で割った余りを出力する　のとき使う*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

string S;
int count;

int main(void) {
  cin >> S;

  if(S[0]==S[1] && S[2]==S[3] && S[0]!=S[2]) cout << "Yes" << endl;
  else if(S[0]==S[2] && S[1]==S[3] && S[0]!=S[1]) cout << "Yes" << endl;
  else if(S[0]==S[3] && S[1]==S[2] && S[0]!=S[1]) cout << "Yes" << endl;  
 
  else cout << "No" << endl;
  return 0;
}


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

using ll = long long;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())

ll grid[3001][3001];
const ll p = 998244353;

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

	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int a,b,c,d;
	cin>>a>>b>>c>>d;

	for(int i=1; i<=a; i++)
	{
		for(int j=1; j<=b; j++)
		{
			grid[i][j]=1LL;
		}
	}

	for(int i=a+1; i<=c; i++)
	{
		grid[i][b] = grid[i-1][b]*ll(b);
		grid[i][b] %= p;
	}

	for(int j=b+1; j<=d; j++)
	{
		grid[a][j] = grid[a][j-1]*ll(a);
		grid[a][j] %= p;
	}

	for(int i=a+1; i<=c; i++)
	{
		for(int j=b+1; j<=d; j++)
		{
			if(grid[i][j]==1LL) continue;

			grid[i][j] += ll(i)*grid[i][j-1];
			grid[i][j]%=p;
			grid[i][j] += ll(j)*grid[i-1][j];
			grid[i][j]%=p;

			ll cur = ll(i-1)*ll(j-1)*grid[i-1][j-1];
			cur%=p;

			grid[i][j] += p-cur;
			grid[i][j] %= p;

			// cout << i << " " << j << " " << grid[i] << endl;
		}
	}

	cout << grid[c][d] << "\n";
}

Measured memory_bytes: 73868