akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int w, h;
vector<vector<int>> dist;
struct Wall
{
  bool upper, lower, left, right;
};
vector<vector<Wall>> wall;

void init()
{
  dist.resize(h, vector<int>(w));
  wall.resize(h, vector<Wall>(w));
  dist.assign(h, vector<int>(w, 0));
  wall.assign(h, vector<Wall>(w, Wall{false, false, false, false}));
}

void input()
{
  int c;
  for (int i = 0; i < 2 * h - 1; i++)
  {
    if (i % 2 == 0)
    {
      for (int j = 0; j < w - 1; j++)
      {
        cin >> c;
        wall.at(i / 2).at(j).right = bool(c);
        wall.at(i / 2).at(j + 1).left = bool(c);
      }
    }
    else
    {
      for (int j = 0; j < w; j++)
      {
        cin >> c;
        wall.at(i / 2).at(j).lower = bool(c);
        wall.at((i / 2) + 1).at(j).upper = bool(c);
      }
    }
  }
  for (int i = 0; i < h; i++)
  {
    wall.at(i).at(0).left = true;
    wall.at(i).at(w - 1).right = true;
  }
  for (int j = 0; j < w; j++)
  {
    wall.at(0).at(j).upper = true;
    wall.at(h - 1).at(j).lower = true;
  }
}

int dfs()
{
  queue<pair<int, int>> que;
  dist.at(0).at(0) = 1;
  que.push(make_pair(0, 0));
  int cur_y, cur_x;
  while (!que.empty())
  {
    tie(cur_y, cur_x) = que.front();
    que.pop();
    int ny, nx;
    ny = cur_y - 1;
    nx = cur_x;
    if (0 <= ny && ny < h && 0 <= nx && nx < w)
    {
      if (!wall.at(cur_y).at(cur_x).upper)
      {
        if (dist.at(ny).at(nx) == 0)
        {
          dist.at(ny).at(nx) = dist.at(cur_y).at(cur_x) + 1;
          que.push(make_pair(ny, nx));
        }
      }
    }
    ny = cur_y + 1;
    nx = cur_x;
    if (0 <= ny && ny < h && 0 <= nx && nx < w)
    {
      if (!wall.at(cur_y).at(cur_x).lower)
      {
        if (dist.at(ny).at(nx) == 0)
        {
          dist.at(ny).at(nx) = dist.at(cur_y).at(cur_x) + 1;
          que.push(make_pair(ny, nx));
        }
      }
    }
    ny = cur_y;
    nx = cur_x - 1;
    if (0 <= ny && ny < h && 0 <= nx && nx < w)
    {
      if (!wall.at(cur_y).at(cur_x).left)
      {
        if (dist.at(ny).at(nx) == 0)
        {
          dist.at(ny).at(nx) = dist.at(cur_y).at(cur_x) + 1;
          que.push(make_pair(ny, nx));
        }
      }
    }
    ny = cur_y;
    nx = cur_x + 1;
    if (0 <= ny && ny < h && 0 <= nx && nx < w)
    {
      if (!wall.at(cur_y).at(cur_x).right)
      {
        if (dist.at(ny).at(nx) == 0)
        {
          dist.at(ny).at(nx) = dist.at(cur_y).at(cur_x) + 1;
          que.push(make_pair(ny, nx));
        }
      }
    }
  }
  return dist.at(h - 1).at(w - 1);
}

int main()
{
  vector<int> ans;
  while (1)
  {
    cin >> w >> h;
    if (w == 0 && h == 0)
    {
      break;
    }
    init();
    input();
    ans.push_back(dfs());
  }
  for (int i = 0; i < ans.size(); i++)
  {
    cout << ans.at(i) << endl;
  }
}


Measured memory_bytes: 3164
import java.util.*
import kotlin.comparisons.compareBy

fun main(args: Array<String>) {
    abc000X()
}

fun abc000X() {
    var n = readLine()!!.toInt()
    var list = Array(n) { i ->
        readLine()!!.split(" ").let { Restaurant(i + 1, it[0], it[1].toInt()) }
    }

    var sortedList = list.sortedWith(compareBy({ it.name }, { it.score * -1 }))

    sortedList.forEach {
        println(it.index)
    }
}

class Restaurant(val index: Int, val name: String, val score: Int)

Measured memory_bytes: 37936
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i)
#define ALL(c) (c).begin() , (c).end()
#define LL long long
#define int LL
#define inf  (1LL << 60)
#define mod 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
#define lower lower_bound
#define upper upper_bound
#define ZERO(c,n) memset(&c[0],0,sizeof(int)*n)
#define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n
#define pl(a) cout << ""#a": " << a << endl;
#ifdef _DEBUG
#define debug_io fstream cin("input.txt");ofstream cout("output.txt");
template<class T>fstream& operator>>(fstream& is, vector<T>& v)
{
	int n = v.size();
	REP(i, n) {
		is >> v[i];
	}
	return is;
}
#else
#define debug_io ;
#endif
#define debug_input debug_io
#define DOWN(T) std::greater<T>()
template<class T>istream& operator>>(istream& is, vector<T>& v)
{
	int n = v.size();
	REP(i, n) {
		is >> v[i];
	}
	return is;
}
using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>;
using psi = pair<string, int>; using vvi = vector<vi>; using pss = pair<string, string>;
using vpii = vector<pii>;
template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; }
//int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 };
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------

bool ed[55][55];
int dx[8] = { 0,0,1,-1,1,-1,1,-1 };
int dy[8] = { 1,-1,0,0,1,1,-1,-1 };

signed main()
{
	QUICK_CIN;
	debug_input;
	int w, h;
	while (cin >> w >> h, w + h) {
		vector<vi> tile(h,vi(w));
		REP(i, h) {
			REP(j, w) {
				cin >> tile[i][j];
			}
		}

		int ans = 0;
		REP(i, 55) {
			REP(j, 55) {
				ed[i][j] = false;
			}
		}

		REP(i, h) {
			REP(j, w) {
				if (tile[i][j] != 1)
					continue;
				queue<pii> q;
				q.push({ i,j });
				while (q.size()) {
					auto t = q.front();
					q.pop();
					auto y = t.first;
					auto x = t.second;
					if (ed[y][x]) {
						continue;
					}
					tile[y][x] = 2;
					ed[y][x] = true;
					REP(k, 8) {
						auto nx = min(w-1,max(0LL,x + dx[k]));
						auto ny = min(h-1,max(0LL,y + dy[k]));
						if (!ed[ny][nx]&&tile[ny][nx]==1) {
							q.push({ ny,nx });
						}
					}
				}
				ans++;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    int main()
    {
    	ios::sync_with_stdio(false);
        int n;
      	cin>>n;
        vector<ll> as(n),bs(n),cs(n);
        vector<ll> ss(n),ss2(n);
        int i,j;
        for(i=0;i<n;i++)
            cin>>as[i];
        for(i=0;i<n;i++)
            cin>>bs[i];
        for(i=0;i<n;i++)
            cin>>cs[i];
        sort(as.begin(),as.end());
        sort(bs.begin(),bs.end());
        sort(cs.begin(),cs.end());
        ll s=0;
        for(j=n-1,i=n-1;i>=0;i--)
        {
            s += 1;
            while(j>=0 && cs[i]<=bs[j])
            {
                ss[j] = s-1;
                j--;
            }
        }
        for(;j>=0;j--)
            ss[j] = s;
        s = 0;
        for(j=n-1,i=n-1;i>=0;i--)
        {
            s += ss[i];
            while(j>=0 && bs[i]<=as[j])
            {
                ss2[j] = s-ss[i];
                j--;
            }
        }
        for(;j>=0;j--)
            ss2[j] = s;
        s = 0;
        for(i=0;i<n;i++)
            s += ss2[i];
        cout<<s<<endl;
        return 0;
    }

Measured memory_bytes: 4224
#include <iostream>
 
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000
 
int L[MAX/2+2], R[MAX/2+2];
int cnt;
 
void merge(int A[],int n,int left, int mid, int right) {
  int n1 = mid -left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i=0, j=0;
  for(int k=left; k<right; k++) {
    cnt++;
    if(L[i]<=R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
 
void mergeSort(int A[],int n,int left,int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}
 
int main(void) {
  int A[MAX], n, i;
  cnt = 0;
 
  cin >> n;
  for(i=0;i<n;i++) cin >> A[i];
 
  mergeSort(A, n, 0, n);
  for(i=0;i<n;i++) {
    if(i)cout << " ";
    cout << A[i];
  }
  cout << endl;
 
  cout << cnt << endl;
 
  return 0;
}

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

const int MAX_DIGIT = 50;
ll dp[100][2];//xがkと比べてdp[上からi桁までで][kよりsmallerなら1, otherwise 0]

int main(){
    int n; 
    ll k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    memset(dp,-1,sizeof(dp));

    dp[0][0] = 0;
    for(int d = 0; d < MAX_DIGIT; d++){
        ll mask = 1LL<<(MAX_DIGIT - d - 1);
        /*
        cout << "d = " << d << endl;
        cout << (MAX_DIGIT - d - 1)<< "桁shift" << endl;
        cout << "mask = " << mask << endl;
        cout << "mask = " << bitset<MAX_DIGIT>(mask) << endl;
        */
        int num = 0;
        rep(i,n){
            //cout << "a_i  = " << bitset<MAX_DIGIT>(a[i]) << endl;
            if(a[i] & mask) ++num;
        }
        //cout << "num   = " << num << endl;

        //numはbitが1であるaの個数
        ll cost0 = mask * num;//xのd桁目を0にしたとき1が出来る個数
        ll cost1 = mask * (n - num);//xのd桁目を1にしたとき1が出来る個数
        /*
        cout << "cost0 = " << cost0 << endl;
        cout << "cost1 = " << cost1 << endl;
        */
        if(dp[d][1] != -1){
            //d桁目までで x is already smaller than k
            //次の桁は1でも0でも良い
            dp[d+1][1] = max(dp[d+1][1],dp[d][1] + max(cost0,cost1));
        }
        if(dp[d][0] != -1){
            //d桁目まで同じで,d桁目が1であるなら，d+1桁目でそれより小さくするために0にする
            if(k & mask){
                dp[d+1][1] = max(dp[d+1][1],dp[d][0] + cost0);
            }
        }
        if(dp[d][0] != -1){
            //d桁目まで同じでd+1桁目も同じ
            if(k & mask) dp[d+1][0] = max(dp[d+1][0],(dp[d][0] + cost1));//kのd+1桁目のbitが1なら,xのd+1桁目は1
            else dp[d+1][0] = max(dp[d+1][0],(dp[d][0] + cost0));
        }
    }
    cout << max(dp[MAX_DIGIT][0], dp[MAX_DIGIT][1]) << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

int main(){
  int n,q;
  string s;
  cin>>n>>q>>s;
  vector<int>l(q);
  vector<int>r(q);
  
  vector<ll>a(n);
  int tmp=0;
  Rep(i,1,n){
    if(s[i]=='C'&&s[i-1]=='A')tmp++;
    a[i]=tmp;
  }
  
  rep(i,q){cin>>l[i]>>r[i];
    cout<<a[r[i]-1]-a[l[i]-1]<<endl;
  }
    
    
  return 0;
}


Measured memory_bytes: 5104
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    priority_queue<double,vector<double>,greater<double> > pq;
    REP(i,n){
        int v;
        cin >> v;
        pq.push((double)v);
    }
    while((int)pq.size()>1){
        double v1 = pq.top();
        pq.pop();
        double v2 = pq.top();
        pq.pop();
        pq.push((v1+v2)/2.0);
    }
    double ans = pq.top();
    printf("%.6f\n",ans);

    return 0;
}

Measured memory_bytes: 256
def q(a,h):
 d[a]=str(h)
 for b in t[a]:q(b,h+1)
t,p,d={},{},{}
for _ in[0]*int(input()):
 e=input().split()
 t[e[0]]=e[2:]
 for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
for i in sorted(map(int,t)):
 i=str(i)
 f='root'if'-1'==p[i]else'internal node'if t[i]else'leaf'
 print(f'node {i}: parent = {p[i]}, depth = {d[i]}, {f}, {list(map(int,t[i]))}')


Measured memory_bytes: 55932
/*
source: Atcoder 141 E
*/
#include <bits/stdc++.h>
using namespace std;
const int MXN = 5005;
int ans = 0;
int z[MXN];

void z_value(string s){
	int L = 0, R = 0;
	z[0] = 0;
	for (int i = 1; i < (int)s.size(); i++){
		if (i > R)
        {
            z[i] = 0;
        }
        else{
			int ip = i - L;
			if (ip + z[ip] < z[L])
            {
                z[i] = z[ip];
            }
			else
            {
                z[i] = R - i + 1;
            } 
		}
		while (i + z[i] < (int)s.size() && s[i + z[i]] == s[z[i]])
        {
            z[i]++;
        }
		if (i + z[i] - 1 > R){
			L = i;
			R = L + z[i] - 1;
		}
        ans = max(ans, (i > z[i] ? z[i] : i));
	}
}

int main()
{
    int n;
    string s;
    cin >> n >> s;
    ans = -1;
    for(int i = 0; i < n; ++i)
    {
        z_value(s.substr(i));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var hwk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var h = hwk[0];
        var w = hwk[1];
        var k = hwk[2];
        var s = Enumerable.Repeat(0, h).Select(_ => Console.ReadLine().Select(x => x == '1').ToArray()).ToArray();
        var leastOp = int.MaxValue;
        for (int id = 0; id < (1 << (h - 1)); id++)
        {
            var curOp = PopCount(id);
            var iSectionCount = curOp + 1;
            int[] sectionH = new int[h];
            for (int j = 0; j < h - 1; j++) sectionH[j + 1] = sectionH[j] + (id >> j & 1);
            int[] curChocos = new int[iSectionCount];
            for (int j = 0; j < w; j++)
            {
                for (int i = 0; i < h; i++)
                {
                    if (s[i][j]) curChocos[sectionH[i]]++;
                }
                if (curChocos.Any(x => x > k))
                {
                    curOp++;
                    for (int i = 0; i < curChocos.Length; i++) curChocos[i] = 0;
                    for (int i = 0; i < h; i++) if (s[i][j]) curChocos[sectionH[i]]++;
                    if (curChocos.Any(x => x > k)) goto end;
                }
            }
            leastOp = Min(leastOp, curOp);
            end:;
        }
        Console.WriteLine(leastOp);
    }


    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static int PopCount(int n)
    {
        int msb = 0;
        if (n < 0) { n &= int.MaxValue; msb = 1; }
        n = n - ((n >> 1) & 0x55555555);
        n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
        return (int)(((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24) + msb;
    }
}


Measured memory_bytes: 17616
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int n;
  cin >> n;

  cout << 1000 * ceil(n / 1000.0) - n << endl;
}


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


int main()
{
	long long x; cin >> x;

	long long ans = 0;

	long long tmp;

	tmp = x / 500;
	ans += 1000 * tmp;;

	x -= tmp * 500;
	
	tmp = x / 5;
	ans += tmp * 5;
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,ans=0,cr=0;
    string s;
    cin>>s;
    l=s.length();
    for(int i=l-1;i>=0;i--){
        int vl=s[i]-'0';
        if(vl+cr>9) continue;
        vl+=cr;
        if(vl==5)
        {
            if(i>0)
            {
                int vll=s[i-1]-'0';
                if(vll<5) ans+=vl, cr=0;
                else
                {
                    ans+=10-vl;
                    cr=1;
                }
            }
            else ans+=vl, cr=0;
        }
        else if(vl<5)
        {
            ans+=vl;
            cr=0;
        }
        else
        {
            ans+=10-vl;
            cr=1;
        }
    }
    cout<<ans+cr;
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  map<char,int> alphabet;
  for(char a:s){
    if(alphabet.count(a)) {
      cout << "no" << endl;
      return 0;
    }
    else alphabet[a]=1;
  }
  cout << "yes" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	string s;cin>>s;
	string ans;
	for(int i=0; i<s.size(); i++) ans+='x';
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}


// N=M+1 ... N! * 2*M!
// N=M ... N! * M!

int main(){
  ll INF = pow(10,9)+7;
  ll N,M; cin>>N>>M;
  ll r;
  if(abs(N-M)>=2){
    r = 0;
  }else{
    if(N<M) swap(N,M);
    ll kaijo[N+1];
    kaijo[0] = 1;
    for(int i=1;i<=N;i++){
      kaijo[i] = (kaijo[i-1]*i)%INF;
    }
    if(N==M){
      r = (kaijo[N]*2*kaijo[M])%INF;
    }else{
      r = (kaijo[N]*kaijo[M])%INF;
    }
  }
  cout << r;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define M 100000007
void addSelf(ll &a,ll b)
{
    a+=b;
    while(a>=M)a-=M;
}
 
void subSelf(ll &a,ll b)
{
    a-=b;
    while(a<0)a+=M;
}

void solve()
{
    int n,x,t;
    cin >> n >> x >> t;

    int ans;
    if(n%x==0) ans=n/x;
    else ans= n/x+1;

    cout << ans*t << endl;   
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

   /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif */

    clock_t start, end; 
    start = clock(); 
  
    solve(); 
  
    end = clock(); 
  /* 
    double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    cout << "Time taken by program is : " << fixed  
         << time_taken << setprecision(5); 
    cout << " sec " << endl;  */
}



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

const double EPS = (1e-10);
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator + (Point p) {
        return Point(x+p.x, y+p.y);
    }
    Point operator - (Point p) {
        return Point(x-p.x, y-p.y);
    }
    Point operator * (double a) {
        return Point(x*a, y*a);
    }
    Point operator / (double a) {
        return Point(x/a, y/a);
    }

    double abs() {
        return sqrt(norm());
    }
    double norm() {
        return x*x + y*y;
    }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator == (const Point &p) const {
        return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
    }
};
typedef Point Vector;

class Segment {
public:
    Point p1, p2;

    Segment(Point p1, Point p2): p1(p1), p2(p2) {}
};

// 内積
double dot(Vector a, Vector b) {
    return a.x*b.x + a.y*b.y;
}

// 外積
double cross(Vector a, Vector b) {
    return a.x*b.y - a.y*b.x;
}

// 線分s1, s2が直交するか
bool isOrthogonal(Segment s1, Segment s2) {
    return equals(dot(s1.p2-s1.p1, s2.p2-s2.p1), 0.0);
}

// 線分s1, s2が平行であるか
bool isParallel(Segment s1, Segment s2) {
    return equals(cross(s1.p2-s1.p1, s2.p2-s2.p1), 0.0);
}

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

    double x0, y0, x1, y1, x2, y2, x3, y3;
    for (int i = 0; i < n; i++) {
        cin >> x0 >> y0 >> x1 >> y1
            >> x2 >> y2 >> x3 >> y3;
        Segment s1(Point(x0, y0), Point(x1, y1));
        Segment s2(Point(x2, y2), Point(x3, y3));

        if (isParallel(s1, s2)) {
            cout << 2 << endl;
        } else if (isOrthogonal(s1, s2)) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1232
from collections import defaultdict
n, m = list(map(int, input().split()))
graph = defaultdict(list)
e = [tuple(map(int, input().split())) for i in range(m)]
for a, b in e:
  graph[a].append(b)
  graph[b].append(a)

used_v = [False for i in range(n+1)]
used_e = [[False for i in range(n+1)] for i in range(n+1)]
ord_ = [float("INF") for i in range(n+1)]
lowlink = [float("INF") for i in range(n+1)]

def dfs(v, k):
  used_v[v] = True
  ord_[v], lowlink[v] = k, k
  k += 1
  for to in graph[v]:
    if not used_v[to]:
      used_e[v][to] = True
      dfs(to, k)
      lowlink[v] = min(lowlink[v], lowlink[to])
    elif not used_e[to][v]:
      lowlink[v] = min(lowlink[v], ord_[to])

dfs(1, 0)
ans = 0
for a, b in e:
  if ord_[a]<lowlink[b] or ord_[b]<lowlink[a]:
    ans+=1
print(ans)

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())

int main(){
    int a,b;
    CIN(a);
    CIN(b);
    string s;
    CIN(s);
    int counter = 0;
    if(s[a] != '-'){
        cout << "No" << endl;
        return 0;
    }
    REP(s.size()){
        if(s[i] == '-') counter++;
    }
    COUT(counter > 1 ? "No" : "Yes");
    return 0;
}


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

typedef long long int int64;

typedef int EdgeWeight;

typedef struct directedGraph{
  int *vertex;
  EdgeWeight *cost;
  int *next;
  int *start;
  int v,e;
  int pointer;
} graph;

graph* newGraph(const int v,const int e){
  graph *g=(graph *)malloc(sizeof(graph));
  g->vertex=(int *)calloc(e,sizeof(int));
  g->cost=(EdgeWeight *)calloc(e,sizeof(EdgeWeight));
  g->next=(int *)calloc(e,sizeof(int));
  g->start=(int *)calloc(v,sizeof(int));
  for(int i=0;i<v;i++) g->start[i]=-1;
  g->v=v;
  g->e=e;
  g->pointer=0;
  return g;
}

void addEdge(graph *g,const int from,const int to,const EdgeWeight cost){
  const int p=g->pointer;
  g->vertex[p]=to;
  g->cost[p]=cost;
  g->next[p]=g->start[from];
  g->start[from]=p;
  g->pointer++;
  return;
}

typedef struct edge{
  int a,b,c;
} edge;

int cmpEdge(const void *a,const void *b){
  return ((edge *)a)->c-((edge *)b)->c;
}

typedef struct UnionFind{
  int *parent;
  int64 *weight;
  int n;
} UnionFind;

UnionFind* newUnionFind(int n,int *x){
  UnionFind *u=(UnionFind *)calloc(1,sizeof(UnionFind));
  u->parent=(int *)calloc(n,sizeof(int));
  u->weight=(int64 *)calloc(n,sizeof(int64));
  int i;
  for(i=0;i<n;i++){
    u->parent[i]=i;
    u->weight[i]=x[i];
  }
  return u;
}

int root(UnionFind *u,int x){
  if(u->parent[x]==x) return x;
  return u->parent[x]=root(u,u->parent[x]);
}

int64 getWeight(UnionFind *u,int x){
  return u->weight[root(u,x)];
}

void unite(UnionFind *u,int x,int y){
  x=root(u,x);
  y=root(u,y);
  if(x==y) return;
  u->parent[x]=y;
  u->weight[y]+=u->weight[x];
}

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  int *x=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",x+i);
  edge *e=(edge *)calloc(m,sizeof(edge));
  graph *g=newGraph(n,2*m);
  for(i=0;i<m;i++){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    a--;b--;
    addEdge(g,a,b,c);
    addEdge(g,b,a,c);
    e[i]=(edge){a,b,c};
  }
  qsort(e,m,sizeof(edge),cmpEdge);
  UnionFind *u=newUnionFind(n,x);
  int64 *weight=(int64 *)calloc(m,sizeof(int64));
  for(i=0;i<m;i++){
    unite(u,e[i].a,e[i].b);
    weight[i]=getWeight(u,e[i].a);
  }
  int cnt=0;
  int *ok=(int *)calloc(n,sizeof(int));
  int *q=(int *)calloc(n,sizeof(int));
  for(i=m-1;i>=0;i--){
    if(ok[e[i].a]) continue;
    int cost=e[i].c;
    if(cost<=weight[i]){
      int front=0,last=0;
      ok[e[i].a]=1;
      q[last++]=e[i].a;
      while(front<last){
	int v=q[front++];
	for(int p=g->start[v];p!=-1;p=g->next[p]){
	  int u=g->vertex[p];
	  int c=g->cost[p];
	  if(c>cost) continue;
	  if(ok[u]) continue;
	  ok[u]=1;
	  q[last++]=u;
	}
      }
    } else {
      cnt++;
    }
  }
  printf("%d\n",cnt);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 7272
import math 

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

n = 100003

so_list = sieve_of_eratosthenes(n)
N = int(input())

for one in so_list:
    if one>=N:
        print(one)
        break

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; i++) cin >> d.at(i);
  
  sort(d.begin(), d.end());
  int count = 1;
  for(int i = 0; i < n-1; i++){
    if(d.at(i) < d.at(i + 1)) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int S(long long x) {
if(x < 10) return x;
return (x%10) + S(x/10);
}
int main() {
long long s;
cin >> s;
int ans = S(s);
int cur = 0;
while(s/10) {
s/=10;
cur += 9;
ans = max(ans, cur + S(s-1));
}
cout << ans;

}


Measured memory_bytes: 3604
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const n: number = tmp[0].split(" ").map(int => parseInt(int))[0];
    const x: number[] = tmp[1].split(" ").map(int => parseInt(int));
    let m: number = 100*100*100;
    for (let i = Math.min.apply(null, x), len = Math.max.apply(null, x); i <= len; i++) {
      let d = 0;
      for (let j = 0; j < n; j++) {
        d += (x[j] - i) * (x[j] - i);
      }
      if (d < m) {
        m = d;
      }
    }
    return `${m}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 7372
#include <stdio.h>
#define N 2002
#define M 1000000007
typedef long long LL;

LL f[N], h[N], s;

int main()
{	 
	int n, i, j, k;
		
	scanf("%d", &n);
	for(h[0] = h[j = 1] = 1, i = 2; i <= n; j = i++){
		h[i] = h[j] << 1;
		if(h[i] >= M) h[i] -= M;
	}
	f[0] = 1, f[1] = f[2] = 0;
	
	for(i = 3; i <= n; i++){
		s = f[i - 1];
		for(j = i - 2, k = 0; j >= 0; j--, k++){
			s += f[j] * (h[k] + h[k + 1]) % M;
		}
		s %= M;
		s = h[i] - s;
		if(s < 0) s += M;
		f[i] = s;
	}
	printf("%lld\n", f[n]);		
		
	return 0;
}

Measured memory_bytes: 1744
package main

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

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var N int
	fmt.Scan(&N)
	var ac, wa, tle, re int
	var str string
	for i := 0; i < N; i++ {
		fmt.Scan(&str)
		if str == "AC" {
			ac++
		} else if str == "WA" {
			wa++
		} else if str == "TLE" {
			tle++
		} else if str == "RE" {
			re++
		}
	}
	fmt.Fprintf(wtr, "AC x %d\n", ac)
	fmt.Fprintf(wtr, "WA x %d\n", wa)
	fmt.Fprintf(wtr, "TLE x %d\n", tle)
	fmt.Fprintf(wtr, "RE x %d\n", re)

	_ = wtr.Flush()
}


Measured memory_bytes: 6328
fn func(input_str: &str) -> Vec<usize> {
    let mut iter = input_str.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let q: usize = iter.next().unwrap().parse().unwrap();
    let s: Vec<char> = iter.next().unwrap().chars().collect();
    let mut ans = Vec::new();
    let mut cnt_acm = vec![0; n];
    let mut cnt = 0;
    for i in 0..n-1 {
        if s[i] == 'A' && s[i+1] == 'C' {
            cnt += 1;
        }
        cnt_acm[i+1] = cnt;
    }
    for _ in 0..q {
        let l: usize = iter.next().unwrap().parse().unwrap();
        let r: usize = iter.next().unwrap().parse().unwrap();
        ans.push(cnt_acm[r-1] - cnt_acm[l-1]);
    }
    ans
}

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let ans = func(&buf[..]);
    for a in ans {
        println!("{}", a);
    }
}

Measured memory_bytes: 8956
#include <cstdint>
#include <iostream>

int main(void)
{
    uint32_t K, X;

    std::cin >> K >> X;

    auto check = [&](){
        if (500*K >= X) return "Yes";
        return "No";
    };

    std::cout << check() << std::endl;

    return 0;
}

Measured memory_bytes: 256
// Ivan Carvalho
// Problem L - Educational Dynamic Programming Contest - AtCoder
// Link : https://atcoder.jp/contests/dp
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MAXN = 3002;

ll dp[MAXN][MAXN];
bool vis[MAXN][MAXN];
int A[MAXN],N;

ll solve(int i,int j){

	if(vis[i][j]) return dp[i][j];

	vis[i][j] = 1;

	if(i == j) return dp[i][j] = A[i];

	return dp[i][j] = max(A[i] - solve(i+1,j), A[j] - solve(i,j-1));

}

int main(){

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

	cout << solve(1,N) << endl;

	return 0;

}

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



int main() {
  int N =0;
  cin >> N;
string a,b;
  cin >> a >> b;
string c = "";
  
  for(int i=0; i<N; i++){
   c = c +a.at(i) + b.at(i); 
  }
  cout << c;
  
}

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

int main(int argc, char const *argv[])
{
    int N;
    string S;
    cin >> N >> S;

    if (N % 2)
    {
        cout << "No" << endl;
        return 0;
    }

    vector<char> S1(N / 2);
    vector<char> S2(N / 2);

    for (size_t i = 0; i < N / 2; i++)
    {
        S1.at(i) = S[i];
    }

    for (size_t i = 0; i < N / 2; i++)
    {
        S2.at(i) = S[i + (N / 2)];
    }

    string ans;

    if (S1 == S2)
    {
        ans = "Yes";
    }
    else
    {
        ans = "No";
    }

    cout << ans << endl;
}


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

const int N=2e5+20;

int n,dp[2];
char a[N];

int mul(int a,int b,int MOD) {return (1ll*a*b)%MOD;}

int power(int a,int b,int MOD)
{
	int num=a,ans=1;
	while(b)
	{
		if(b&1) ans=mul(ans,num,MOD);
		b>>=1;
		num=mul(num,num,MOD);
	}
	return ans;
}

int main()
{
	scanf("%d %s",&n,a);

	int ones=count(a,a+n,'1');
	int cnt[]={ones+1,ones-1};

	if(cnt[1]==-1)
	{
		for(int i=0;i<n;i++) printf("1\n");
		return 0;
	}

	int num=0;
	for(int i=n-1,p=1;i>=0;i--,p=(p*2)%cnt[0])
	{
		if(a[i]=='1') num+=p;
		num%=cnt[0];
	}

	int num1=0;
	if(cnt[1])
	{
		for(int i=n-1,p=1;i>=0;i--,p=(p*2)%cnt[1])
		{
			if(a[i]=='1') num1+=p;
			num1%=cnt[1];
		}
	}

	for(int i=0;i<n;i++)
	{
		if(a[i]=='0')
		{
			int newnum=num;
			newnum=(newnum+power(2,n-1-i,cnt[0]))%cnt[0];
			int steps=1,d=__builtin_popcount(newnum);
			while(newnum)
			{
				newnum%=d;
				d=__builtin_popcount(newnum);
				steps++;
			}
			printf("%d\n",steps);
		}
		else
		{
			if(cnt[1]==0)
			{
				printf("0\n");
				continue;
			}
			int newnum=num1;
			newnum=(newnum-power(2,n-1-i,cnt[1])+cnt[1])%cnt[1];
			int steps=1,d=__builtin_popcount(newnum);
			while(newnum)
			{
				newnum%=d;
				d=__builtin_popcount(newnum);
				steps++;
			}
			printf("%d\n",steps);
		}
	}
}

Measured memory_bytes: 3972
import java.util.Objects;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		for (int i = 2, f = s.length(); i <= f; ++i) {
			if (Objects.equals(s.substring(i - 2, i), "AC")) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

}


Measured memory_bytes: 22612
import java.util.Scanner;
import java.util.LinkedList;
import java.lang.Math;
import java.util.Arrays;
import java.util.Collections;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n;
        n = s.length();
        for(int i=0;i<n;i++){
            System.out.print("x");
        }
    }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        int r, c;
        cin >> r >> c;
        if (r == 0) break;
        int g[r][c] = {};
        rep(i, r)rep(j, c) cin >> g[i][j];
        int ans = 0;
        rep(i, 1<<r) {
            int tmp[r][c] = {};
            rep(j, r) {
                if (i >> j & 1) {
                    rep(k, c) tmp[j][k] = g[j][k]^1;
                }
                else {
                    rep(k, c) tmp[j][k] = g[j][k];
                }
            }
            int total = 0;
            rep(k, c) {
                int cnt = 0;
                rep(j, r) {
                    if (tmp[j][k] == 0) cnt++;
                }
                total += max(cnt, r - cnt);
            }
            ans = max(ans, total);
        }
        cout << ans << endl;
    }
}

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

#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

int s,n,m;
void solve(){
	cin>>n>>m;
	vi v,v2;
	rep(i,0,m){
		int t;
		cin>>t;
		v.pb(t);
	}
	if(n>=m){
		cout<<0<<endl;
		return;
	}
	sort(all(v));
	rep(i,1,m)
		v2.pb(v[i]-v[i-1]);
	s = v[m-1]-v[0];
	sort(all(v2));
	reverse(all(v2));
	rep(i,0,n-1)
		s-=v2[i];
	cout<<max(0,s)<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
 //    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>

int main()
{
	int n, m, k;
	std::cin >> n >> m >> k;
	std::vector<int> a(n, 0), b(m, 0);
	for (int i = 0; i < n; i++)
		std::cin >> a[i];
	for (int j = 0; j < m; j++)
		std::cin >> b[j];

	std::vector<int> sum_a, sum_b; // sum_a[i] = sum of i books from a
	int sum = 0;
	int i = 0;
	while (sum <= k)
	{
		sum_a.push_back(sum);
		if (i == a.size())
			break;
		sum += a[i++];
	}
	sum = 0;
	i = 0;
	while (sum <= k)
	{
		sum_b.push_back(sum);
		if (i == b.size())
			break;
		sum += b[i++];
	}

	int cur_max = 0;
	int books_a = 0;
	int books_b = sum_b.size() - 1;
	while (true)
	{
		int cur_books = books_a + books_b;
		if (cur_books > cur_max)
			cur_max = cur_books;
		books_a++;
		if (books_a == sum_a.size())
			break;
		while (sum_a[books_a] + sum_b[books_b] > k)
			books_b--;
	}

	std::cout << cur_max << std::endl;
}

Measured memory_bytes: 7160
#include <iostream>
using namespace std;
#define ll long long
const int N = 55;
ll C[N][N];
int main(){
    for(int i = 0; i < N; i++){
        C[i][0] = 1;
        for(int j = 1; j <= i; j++) C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
    int even = 0, odd = 0;
    int A[N];
    int n, p;
    cin >> n >> p;
    for(int i = 1; i <= n; i++){
        cin >> A[i];
        if(A[i] & 1) odd++;
        else even++;
    }
    ll ans = 0;
    for(int i = 0; i <= odd; i++)
        for(int j = 0; j <= even; j++){
            if(i % 2 == p) ans += C[odd][i] * C[even][j];
        }
    cout << ans;
//    45 1
//    17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
bool chmin(ll&a,ll b){if(a>b){a=b;return true;}return false;}
bool chmax(ll&a,ll b){if(a<b){a=b;return true;}return false;}
#define debg cout<<"debg"<<endl
void printVec(const vector<ll>&a){
  for(auto elm:a)cout<<elm<<" ";
  cout<<endl;
}
#define out(a) cout<<(a)<<endl
signed main(){
  
  ll n;cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll ans=0;
  for(auto&x:a){
    while(x%2==0){
      x/=2;
      ans++;
    }
  }
  out(ans);

  return 0;
}



Measured memory_bytes: 384
function Main(input) {
    input = input.split(' ').map(n => parseInt(n));
    n = input[0];
    a = input[1];
    b = input[2];
    p1 = a * n;
    p2 = b;
    if(p1 <= p2) {
        console.log(p1);
    } else{
        console.log(p2);
    }

    
    }
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

using int64 = long long;

void operator*=(vector< int > &latte, const vector< int > malta)
{
  for(int i = 0; i < malta.size(); i++) {
    latte[i] = malta[latte[i]];
  }
}

vector< int > mod_pow(vector< int > x, int64 n)
{
  vector< int > ret(x.size());
  iota(begin(ret), end(ret), 0);
  while(n > 0) {
    if(n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return (ret);
}

int main()
{
  int N, M, A[100000];
  int64 K, X[100000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> X[i];
  }
  cin >> M >> K;
  for(int i = 0; i < M; i++) {
    cin >> A[i];
    --A[i];
  }

  int64 B[100000];
  vector< int > order(N - 1);
  iota(begin(order), end(order), 0);
  for(int i = 0; i < M; i++) {
    swap(order[A[i] - 1], order[A[i]]);
  }
  order = mod_pow(order, K);

  cout << X[0] << endl;
  auto base = X[0];
  for(int i = 0; i < N - 1; i++) {
    base += X[order[i] + 1] - X[order[i]];
    cout << base << endl;
  }
}

Measured memory_bytes: 3176
s = gets.chomp

x = s.split("")
n = x.length

if x[0..n] == x[0..n].reverse
    if (x[0...((n - 1) / 2)] == x[0...((n - 1) / 2)].reverse) && (x[((n + 3) / 2) - 1...n] == x[((n + 3) / 2) - 1...n].reverse)
    puts 'Yes'
    else puts 'No'
    end
else puts 'No'
end

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

# define ll long long
ll mod=pow(10,9)+7;

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

    int n;
    cin>>n;
    n=n%1000;
    n=1000-n;
    cout<<n%1000<<endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cstdint>
using namespace std;

#define N 200000

int a[N];
 
int main()
{
	int n;

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

	long long ans = 0;
	int acc = 0;
	int l = 0, r = 0;
	while( l < n ) {
		while ( r < n ) {
			if ( (acc & a[r]) != 0 ) {
				break;
			}
			acc += a[r];
			r++;
		}

		ans += r - l;

		acc -= a[l];
		l++;
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
  ll x;
  cin>>x;
  V can(x+1,0);
  rep(i,6)if(100+i<=x)can[100+i]=1;
  for(ll i=0;i<=x;i++){
    if(can[i]==1){
      rep(j,6)if(i+100+j<=x)can[i+100+j]=1;
    }
  }
  cout<<can[x]<<endl;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"math"
)

func chmin(a *int, b int) bool {
	if *a > b {
		(*a) = b
		return true
	}
	return false
}

func main() {
	var N, W int
	fmt.Scan(&N, &W)

	const INF = 1 << 30            // 2^30
	var max_v = int(math.Pow10(6)) // 10^5

	var dp = make([][]int, N+1)
	for i := range dp {
		dp[i] = make([]int, max_v)

		for j := 0; j < max_v; j++ {
			dp[i][j] = INF
		}
	}
	dp[0][0] = 0

	var weight = make([]int, N)
	var value = make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&weight[i], &value[i])
	}

	for i := 0; i < N; i++ {
		for sum := 0; sum < max_v; sum++ {
			if sum-value[i] >= 0 {
				chmin(&dp[i+1][sum], dp[i][sum-value[i]]+weight[i])
			}
			chmin(&dp[i+1][sum], dp[i][sum])
		}
	}

	var res int
	for i, v := range dp[N] {
		if v <= W {
			res = i
		}
	}
	fmt.Println(res)
}

Measured memory_bytes: 816128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
long long n,m,x,y;
int main()
{
    cin>>n>>m;
    cout<<(n+m)/2+(n+m)%2;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int q,w,e,r,t,y,u,i,o,p;
	scanf("%d %d %d %d %d %d %d %d %d %d",&q,&w,&e,&r,&t,&y,&u,&i,&o,&p);
	printf("%d\n",q+w+e+r+t+y+u+i+o+p);
	return 0;
}


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

int main(){

	int a = 0;
	int b[10000] = { 0 };
	int x = 0;


	for (int i = 0; i < 10000; i++){
		cin >> a;

		if (a == 0){
			break;
		}
		cout << "Case " << i + 1 << ": " << a << endl;
	}

}

Measured memory_bytes: 3052
#include<stdio.h>
int main()
{
  int a,b,c,d,e;
  scanf("%d %d %d",&a,&b,&c);
  d=b;
  b=a;
  a=d;
  e=c;
  c=a;
  a=e;
  printf("%d %d %d",a,b,c);
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n,k;cin>>n>>k;
    //差し込む場所(n-k+1)C(i)
    //それぞれの場所に入れる数(K-1)C(i-1)
    //K個の玉の間にi-1個の仕切りを挿れて、iつの組に分割するイメージ
    ll dp[2001][2001];rep(i,0,2001)rep(j,0,2001) dp[i][j] = 0;
  	rep(i,0,2001) dp[i][0] = 1;
    rep(i,1,2001)
        rep(j,1,i+1)
            dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % MOD;
    rep(i,1,k+1){
        cout << (dp[n-k+1][i] * dp[k-1][i-1]) % MOD << ednl;
    }
}


Measured memory_bytes: 31488
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	ll i,j,k,l,n;
	cin>>n;
	i=1; j=1e10;
	ll mid,an=0;
	while(j>=i){
		mid=(i+j)/2;
		
		k=(mid*(mid+1))/2;
		if(k>=n){
			an=mid;
			j=mid-1;
		}
		else i=mid+1;
	}
	cout<<an;
	return 0;
}

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

using namespace std;

typedef long long ll;
const int MOD = 998244353;

int add(int a, int b) {
  a += b;
  if (a >= MOD) {
    return a - MOD;
  }
  if (a < 0) {
    return a + MOD;
  }
  return a;
}

int mul(int a, int b) {
  return a * (ll) b % MOD;
}

int pw(int a, int b) {
  int r = 1;
  while (b) {
    if (b & 1) {
      r = mul(r, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return r;
}

int dv(int a, int b) {
  return mul(a, pw(b, MOD - 2));
}

const int N = 1000000 + 7;
int n, f[N];
int sol, sum[N], ans[N];

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

  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    f[x]++;
    sol = add(sol, -x);
  }

  for (int i = 1; i < N; i++) {
    for (int j = i; j < N; j += i) {
      sum[i] = add(sum[i], mul(j, f[j]));
    }
  }

  for (int g = N - 1; g >= 1; g--) {
    ans[g] = mul(sum[g], sum[g]);
    for (int g2 = 2 * g; g2 < N; g2 += g) {
      ans[g] = add(ans[g], -ans[g2]);
    }
    sol = add(sol, dv(ans[g], g));
  }
  cout << dv(sol, 2) << "\n";


  return 0;
}


Measured memory_bytes: 12032
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        std::cout << b << '\n';
    } else if (6 <= a && a <= 12) {
        std::cout << b / 2 << '\n';
    } else {
        std::cout << 0 << '\n';
    }

    return 0;
}

Measured memory_bytes: 256