akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
 
using namespace std;
 
int main() {
    std::string S;
    cin >> S;
    std::string T;
    cin >> T;
    int out=0;
    if(S == T){cout << out << endl;}
    else{
      for(int i = 0; i < (int)S.size(); ++i)
      {
         char s_tmp = S[i];
         if(s_tmp == T[i]){continue;}
         else{out+=1;}
      }
      cout << out << endl;
    }
}


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

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

    int c[N], t[N];
    int min_time = T;
    int min_cost = 1000;
    bool flag = false;
    for(size_t i = 0; i < N; i++)
    {
        cin >> c[i] >> t[i];
        if (t[i] <= T)
        {
            flag = true;
            if (c[i] < min_cost)
            {
                min_cost = c[i];
            }
        }
    }

    if (flag)
    {
        cout << min_cost << endl;
    }
    else
    {
        cout << "TLE" << endl;
    }

    return 0;
    
}

Measured memory_bytes: 256
x = int(input())
rem = x%100
flag = False
while x > 0:
  if rem >= 5:
    rem -= 5
    x -= 105
  elif rem == 4:
    rem -= 4
    x -= 104
  elif rem == 3:
    rem -= 3
    x -= 103
  elif rem == 2:
    rem -= 2
    x -= 102
  elif rem == 1:
    rem -= 1
    x -= 101
  else:
    x -= 100
if x == 0:
  flag = True
if flag:
  print('1')
else:
  print('0')

Measured memory_bytes: 3064
MOD = 1000000007

l = str(input())
c = [1]
for i in range(len(l) + 1):
	c.append((c[-1] * 3) % MOD)
# print(c)
l = l[::-1]
ans = 1
for i, e in enumerate(l):
	if e == '1':
		ans = (ans * 2 + c[i]) % MOD
print(ans)

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

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

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    if (k <= a) {
        ans = k;
    } else {
        ans = a;
        k -= a;
        if (k > b) {
            k -= b;
            ans -= k;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3588
program sample
    implicit none
    real(8)::a
    integer(8) :: b,c,i,j,m,n,k,a1,b1,c1
    integer(8), allocatable  ::x(:) 

    read(*,*) n
  
    allocate(x(n))
    read(*,*) x
    
    call msort(x)
    a=real(x(1))/2**(n-1)
   
    do i=2,n
       a=a+real(x(i))/2**(n+1-i) 
    end do
    write(*,*)a
    deallocate(x)

    stop

    contains

    recursive subroutine msort(x)
    implicit none
    integer(8), intent(inout) :: x(:)
 
    integer(8) :: n, mid, i, j, k
    integer(8), allocatable :: tmp(:)
    
    n = size(x)
    
    if(n == 1) then
      return
    end if
 
    !
    ! 前半と後半に分けてソート
    ! 1~midとmid+1~nをそれぞれソート済みにする
    !
    mid = n / 2
    call msort(x(:mid))
    call msort(x(mid+1:))
 
    !
    ! tmpという配列にxを一時的に保管
    ! マージソートは外部ソート
    !
    allocate(tmp(n))
    tmp = x
 
    ! tmpの後半部分を左右反転
    do k = n, mid+1, -1
      tmp(k) = x(mid + n - k + 1)
    end do
 
    ! iは前半のリストのうちまだ見ていないものの最小値
    ! jは後半のリストのうちまだ見ていないものの最小値
    ! kは見た回数の合計
    i = 1
    j = n
 
    do k = 1, n
      !
      ! 一番左と一番右のうち小さい方をxに入れていく
      ! ここが等号つき不等号なので、安定ソートとなる
      !
      if(tmp(i) <= tmp(j)) then
        x(k) = tmp(i)
        i = i + 1
      else
        x(k) = tmp(j)
        j = j - 1
      end if
    end do
    
    deallocate(tmp)
    return
  end subroutine msort
end program sample
  



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

using namespace std;

int INF = 10000000;

int n;



int main()
{

	while(cin >> n && n)
	{
		int sx = 10,sy = 10;
		
		bool cell[21][21];
		memset(cell,0,21*21*sizeof(bool));

		for(int i = 0;i < n;i++)
		{
			int x,y;
			cin >> x >> y;
			cell[x][y] = true;
		}

		cell[sx][sy] = false;

		int m;
		cin >> m;

		for(int i = 0;i < m;i++)
		{
			char order;
			int val;

			cin >> order >> val;

			if(order == 'N')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx][++sy] = false;
				}
				
			}
			if(order == 'E')
			{
				for(int j = 0;j < val;j++)
				{
					cell[++sx][sy] = false;
				}
			}
			if(order == 'S')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx][--sy] = false;
				}
			}
			if(order == 'W')
			{
				for(int j = 0;j < val;j++)
				{
					cell[--sx][sy] = false;
				}
			}

		}
		bool flag = false;

		for(int i = 0;i < 21;i++)
		{
			for(int j = 0;j < 21;j++)
			{
				if(cell[i][j])flag = true;
			}
		}

		if(flag)cout << "No" << endl;
		else    cout << "Yes"  << endl;

	}

  return 0;
}

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

int main() {
	// your code goes here
	int x,a,b,c,d=0;
	cin>>a>>b>>c>>x;
	int i,j,k;
	for(i=0;i<=a;i++)
	{
	    for(j=0;j<=b;j++)
	    {
	        for(k=0;k<=c;k++)
	        {
	            if(i*500+j*100+k*50==x)
	            d++;
	        }
	    }
	}
	cout<<d<<endl;
	
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }



int main()
{
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    int N,M;    
    cin >> N >> M;
    if(N==M) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (int)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);

vector<vector<ll>> init(int x){

    vector<vector<ll>> ans(x+1,vector<ll>(0));

    for(int i=1;i <= x;i++)
    {
        for(int j=0;j <= i;j++)
        {
            if(j==0 || j==i) ans[i].emplace_back(1);
            else ans[i].emplace_back(ans[i-1][j-1]+ans[i-1][j]);            
        }
    }
    return ans;
}


int BS(vector<ll> v,ll x){
  int ue=-1,st=siz(v);

  while(abs(ue-st)>1){
    int mid=(ue+st)/2;

    if(v[mid]>=x)ue=mid;
    else st=mid;
  }
  return ue;
}


signed main(){
  int n,a,b,ansi=1;cin>>n>>a>>b;
  ll cnt=0,ans=-1;
  vector<vector<ll>> c=init(52);

  vector<ll> v(n,-1),sum(b+1,0); 
  rep(i,n)cin>>v[i];

  sort(all(v),greater<ll>());

  for(int i=1;i <= b;i++)
  {
    sum[i]=v[i-1]+sum[i-1];
  }



  for(int i=a;i <= b;i++)
  {
    if(i*ans<=sum[i]*ansi){
      ans=sum[i];
      ansi=i;

      if(i*ans < sum[i]*ansi) cnt=0;

      int nmx=BS(v,v[i-1]),mx=BS(v,v[i-1]+1);
      //cout<<nmx<<":"<<mx<<endl;
      
      cnt+=c[nmx-mx][i-mx-1];
      
    }
    
  }

  printf("%.11lf\n",((double)ans/ansi));
  cout<<cnt<<endl;
}

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

using namespace std;

typedef long long int ll;

#define FOR(i,l,r) for(i=l;i<r;i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(x) x.begin(),x.end()

#define P pair<ll,ll>

#define F first

#define S second

signed main(){

  string N;cin>>N;
  N[1]=(char)('R'+'B'-N[1]);

  cout<<N<<endl;

  return 0;

}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define se second
#define fi first
#define rep(i, l, r) for (ll i = (ll)(l); i < (ll)(r); i++)
#define print(v) for (const auto itr : v){cout << itr << ' ';} cout << endl;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define inf 1e18
using namespace std;
const ll INF = 1e18L + 5;
const ll maxn = 1e5+5, maxn1=202;
ll ceel(ll a, ll b)
{
   if (a % b == 0)
       return a / b;
   return a / b + 1;
}
ll modneg(ll a,ll m)
{
    a = a % m;
    if(a<0)
        a=a+m;
    return a;
}
ll powermod(ll x, unsigned ll y, ll p){ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); };
ll csb(ll n){ ll count = 0;while (n){ count += n & 1; n >>= 1; } return count;}


int main()
{

fastIO;
ll test,t,i,j,k,n,m,a,b,x,y,u,temp;
cin>>n>>k;
map <ll,ll> mp;
rep(i,0,k)
{
    cin>>x;
    rep(j,0,x)
    {
        cin>>a;
        mp[a]=x;
    }
}
ll cnt=0;
rep(i,1,n+1)
{
    if(mp.find(i)==mp.end())
        cnt++;
}
cout<<cnt;
return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >>d;
  int left = a+b;
  int right = c+d;

  if (left > right) {
      cout << "Left" << endl;
  } else if (left < right) {
      cout << "Right" << endl;
  } else {
      cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = new Date();
  Main();
  var end = new Date() - start;
  
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}


//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var D = nextInt();
	var clist = nextIntArray();
	var output = new Array(D);
	var lastContest = new Array(26).fill(0);
	for(var i = 1; i <= D; i++){
		var list = nextIntArray();
		output[i - 1] = (i % 26) + 1;
	}
	myout(myconv(output,9));
}


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

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

    string str;
    int sabs = 0, sa = 0,bs = 0, bsa = 0;
    for (int  i = 0; i < N; i++){
        cin >> str;
        //cout << str << endl;
        for (int j = 0; j < str.length() - 1; j++){
            if(str[j] == 'A' && str[j+1] == 'B')
                sabs++;
        }
        
        if(str.back() == 'A' && str.front() == 'B')
            bsa++;
        else if(str.back() == 'A')
            sa++;
        else if(str.front() == 'B')
            bs++;
        //cout << sabs << " BsA= " << bsa <<" A= " << sa << " B= " << bs << endl;
    }
    //cout << sabs + (bsa > 0 ? bsa - 1 + (sa > bs ? min(sa, bs + 1) : min(sa + 1, bs)) : min(sa,bs) ) << endl;
    int count = sabs;
    if(bsa > 0){
        if(sa + bs > 0) count += bsa + min(sa,bs);
        else count += bsa - 1; 
    }
    else count += min(sa ,bs);


    cout << count << endl;

    return 0;

}

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

using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    long dp;
    vector<long> a,b;
    b.push_back(0);
    for(int i=0;i<n;i++)
    {
        cin >> dp;
        if(dp==0)
            k--;
        else if(dp<0)
            a.push_back(-dp);
        else
            b.push_back(dp);
    }
    a.push_back(0);
    int x=a.size()-1;
    int y=b.size()-1;
    vector<long> d;
    reverse(a.begin(),a.end());
    for(int i=max(k-y,0);i<=min(x,k);i++)
    {
        d.push_back(min(a[i],b[k-i])+min(a[i],b[k-i])+max(a[i],b[k-i]));
    }
    sort(d.begin(),d.end());
    cout << d[0];
    return 0;
}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 510000;
const int INF = 1e9;
const double pi=acos(-1);
 
int main(){
  int n;
  cin >> n;
  cout << (n+1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	var toping = 0;
	for(var i = 0;i<3;i++){
		if(input[i] == 'o'){
			toping = toping + 100
		}
	}
	
	//出力
	console.log(toping + 700);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
'use script';

{
function Main(input) {
	//input = input.split("\n");
	tmp = input.split(" ");
	const a = BigInt(tmp[0], 10);
	const b = BigInt(tmp[1], 10);
	const c = BigInt(tmp[2], 10);
	const d = BigInt(tmp[3], 10);

  	let max = a*c;
  
	if(max < a*d){
      max = a*d;
    }
	if(max < b*c){
      max = b*c;
    }
  	if(max < b*d){
      max = b*d;
    }
  
  	console.log(max.toString());
  
	}

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

}


Measured memory_bytes: 29620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5e2+20;
const ll mod=1e9+7;
int n;
char a[N],b[N];
int main()
{
	while(cin>>n)
	{
		scanf("%s%s",a+1,b+1);
		ll ans=1,i;
		if(a[1]==b[1])
			ans*=3,i=2;
		else 
			ans*=6,i=3;
		for(;i<=n;i++)
		{
			if(a[i]==b[i])
			{
				if(a[i-1]==b[i-1])
					ans=(ans*2ll)%mod;
			}
			else
			{
				if(a[i]==a[i-1]&&b[i]==b[i-1])
				{
					if(a[i-2]==b[i-2])
						ans=(ans*2ll)%mod;
					else
						ans=(ans*3ll)%mod;
				}
			}
		}
		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;

int main() {

  int a,b,c;
  cin >> a >> b >> c;
  
  a -= c;
  
  cout << a/(b+c) << endl;
  
  
}


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

typedef pair<int, int> P;

int main(){
    vector<char> t(3);

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

    int cnt = 0;
    for(int i = 0; i < 3; i++){
        if(i == 0){
            if(t[i] == 'R'){
                cnt++;
            }else{
                cnt = 0;
            }
        }
        if(i != 0){
            if(t[i - 1] == 'R' && t[i] == 'R'){
                cnt++;
            }else if(t[i - 1] == 'S' && t[i] == 'R'){
                cnt = 1;
            }
        }   
    }

    // if(t[0] == 'R'){
    //     cnt++;
    // }else{
    //     cnt = 0;
    // }

    // if(t[1] == 'R'){
    //     cnt++; 
    // }

    // if(t[2] ==  'R' && t[1] == 'R'){
    //     cnt++;
    // }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
#define Max 500000
#define term 1000000000

int Left[(Max/2)+2], Right[(Max/2)+2];
int c=0;


void merge(int e[], int n, int left, int mid, int right){
  int i,j,k;

  int x = (mid-left);
  int y = (right-mid);

  for ( i=0; i<x; i++ )
   Left[i] = e[left+i];
  for ( i=0; i<y; i++ )
   Right[i] = e[mid+i];

  Left[x]= Right[y] = term;
  i = j = 0;
  for ( k=left; k<right; k++){
    c++;
    if ( Left[i]<=Right[j] ){
      e[k] = Left[i++];
    } else {
      e[k] = Right[j++];
    }
  }
}

void mergeSort(int e[], int n, int left, int right ){
  int mid;
  if ( left+1<right ){
    mid=(left + right)/2;
    mergeSort(e, n, left, mid);
    mergeSort(e, n, mid, right);
    merge(e, n, left, mid, right);
  }
}

int main(){
  int e[Max], n, i;
  scanf("%d", &n);
  for ( i=0; i<n; i++) {
    scanf("%d", &e[i]);
    if (e[i]>=term ){
      return 1;
    }
  }
  mergeSort(e,n,0,n);

  for ( i=0; i<n; i++) {
    if ( i !=0 ) 
    printf(" ");

    printf("%d", e[i]);
    }
  printf("\n");

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


  return 0;
}




Measured memory_bytes: 5628
import sys

n = int(input())
nl = [111,222,333,444,555,666,777,888,999]

for i in range(len(nl)):
    if(n == nl[i]):
        print(nl[i])
        sys.exit()
    elif(n < nl[i]):
        print(nl[i])
        sys.exit()
    else:
        continue




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

namespace ABC112_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var list = new Model[N];
            for (int i = 0; i < N; i++)
            {
                var line = Console.ReadLine().Split().Select(long.Parse).ToArray();
                list[i] = new Model() { x = line[0], y = line[1], h = line[2] };
            }

            if (N == 1)
            {
                Console.WriteLine($"{list[0].x} {list[0].y} {list[0].h}");
                return;
            }

            list = list.OrderByDescending(n => n.h).ToArray();
            var ans = new Model();
            for (int x = 0; x <= 100; x++)
            {
                for (int y = 0; y <= 100; y++)
                {
                    var first = list[0];
                    var temp = new Model() { x = x, y = y, h = first.h + (Math.Abs(x - first.x) + Math.Abs(y - first.y)) };

                    var flag = true;
                    for (int i = 1; i < N; i++)
                    {
                        var now = list[i];
                        if (Math.Max(temp.h - Math.Abs(x - now.x) - Math.Abs(y - now.y), 0) != now.h)
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (!flag) continue;

                    if (ans.h <= temp.h)
                    {
                        ans = temp;
                    }
                }
            }

            Console.WriteLine($"{ans.x} {ans.y} {ans.h}");
        }

        class Model
        {
            public long x { get; set; }
            public long y { get; set; }
            public long h { get; set; }
        }
    }
}


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

ll cnt[5];
bool used[5];
ll ans;

void dfs(int k, int i) {
  if (k == 3) {
    ll tmp = 1;
    rep(i, 5) if(used[i]) tmp *= cnt[i];
    ans += tmp;
    return;
  }
  for (int j = i+1; j < 5; ++j) {
    if (!used[j]) {
      used[j] = true;
      dfs(k+1, j);
      used[j] = false;
    }
  }
}

int main() {
  int n;
  cin >> n;
  string name[n];
  rep(i, n) cin >> name[i];

  rep(i, n) {
    char x = name[i][0];
    if (x == 'M') ++cnt[0];
    else if (x == 'A') ++cnt[1];
    else if (x == 'R') ++cnt[2];
    else if (x == 'C') ++cnt[3];
    else if (x == 'H') ++cnt[4];
  }
  dfs(0, -1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6144
n, m = map(int, raw_input().split())
a, b, result = list(), list(), list()
for _ in range(n):
    a.append(map(int, raw_input().split()))
for _ in range(m):
    b.append(int(raw_input()))
for i in range(n):
    temp = 0
    for j in range(m):
        temp += a[i][j] * b[j]
    result.append(temp)
for i in result:
    print(i)

Measured memory_bytes: 6632
N = int(input())
L = []
D = {}
for _ in range(N):
  k, v = input().split()
  v = int(v)
  L.append((k, v))
  if k not in D.keys():
    D[k] = [v]
  else:
    D[k].append(v)

for v in D.values():
  v.sort(reverse=True)
D = sorted(D.items(), key=lambda x: x[0])

for d in D:
  for i in range(len(d[1])):
    print(L.index((d[0], d[1][i]))+1)

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int n; cin >> n;
    V<V<P<int, int> > > v(n);
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        v[i].resize(a);
        for(int j = 0; j < a; j++){
            int x, y; cin >> x >> y;
            x--;
            v[i][j] = make_pair(x, y);
        }
    }

    int ans = 0;
    for(int bit = 0; bit < (1 << n); bit++){
        bool flag = true;
        for(int i = 0; i < n; i++){
            if(bit & (1 << i)){
                for(int j = 0; j < (int)v[i].size(); j++){
                    int f = v[i][j].first;
                    int s = v[i][j].second;
                    int b = bit & (1 << f);
                    if(b && s) continue;
                    if(b == 0 && s == 0) continue;
                    else{
                        flag = false;
                        break;
                    }
                }
            }
            if(!flag) break;
        }
        if(flag){
            bitset<15> bs(bit);
            int tmp = bs.count();
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
import java.util.*;
public class Main { 
	static ArrayList<Integer> list = new ArrayList<Integer>();
	static ArrayList<Integer> oddList = new ArrayList<Integer>();
	static int[] dp;
	static int[] odp;
	static int n;
	static int INF = 1 << 22;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		makeList();		
		dp = new int[1000001];
		odp = new int[1000001];
		Arrays.fill(dp, INF);
		Arrays.fill(odp, INF);
		dp[0] = odp[0] = 0;
		dp();
		oddDp();
		while(true) {
			n = stdIn.nextInt();
			if(n == 0) break;
			int ansA = 0;
			int ansB = 0;
			
			ansA = dp[n];
			ansB = odp[n];
			System.out.println(ansA + " " + ansB);
		}
	}
	public static void dp() {
		for(int i = 0; i <= 1000000; i++) {
			for(int j = 0; j < list.size(); j++) {
				int a = list.get(j);
				if(i - a < 0) break;
				if(dp[i - a] + 1 < dp[i]) {
					dp[i] = dp[i-a] + 1;
				}
			}
		}
	}
	public static void oddDp() {
		for(int i = 0; i <= 1000000; i++) {
			for(int j = 0; j < oddList.size(); j++) {
				int a = oddList.get(j);
				if(i - a < 0) break;
				if(odp[i - a]+1 < odp[i]) {
					odp[i] = odp[i-a]+1;
				}
			}
		}
		
	}
	public static void makeList() {
		for(int i = 1; i < 200000; i++) {
			int a = i * (i + 1) * (i + 2);
			if(a % 6 == 0) {
				if(a / 6 > 1000000) break;
				list.add(a / 6);
				if((a / 6) % 2 == 1) {
					oddList.add(a/6);
				}
			}
		}
	}
	
}

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> wa(n), al(n);
  int ac = 0, pe = 0;
  while (m--) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if (s == "WA") {
      if (al[p] == 0) wa[p]++;
    } else {
      if (al[p] == 0) {
        pe += wa[p];
        ac++;
      }
      al[p] = 1;
    }
  }
  cout << ac << ' ' << pe;
  return 0;
}


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

using namespace std;
#define MAXNUM 555555
#define rep(i, s, t) for(int i=s;i<t;i++)
set<int> sl,sr;
int num[MAXNUM], pos[MAXNUM], degree[MAXNUM];
vector<int> e[MAXNUM], res,tmp;
int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    rep(i, 1, n + 1)scanf("%d", &num[i]), pos[num[i]] = i;
    rep(i,1,k + 1)sr.insert(num[i]);
    rep(i,1,n+1)
    {
        if(k==1)break;
        auto iterl=sl.upper_bound(num[i]),iterr=sr.upper_bound(num[i]);
        if(iterl!=sl.end())
            e[pos[*iterl]].push_back(i),degree[i]++;
        if(iterr!=sr.end())
            e[pos[*iterr]].push_back(i),degree[i]++;
        sl.insert(num[i]);
        if(i-k+1>=1)
            sl.erase(num[i-k+1]);
        sr.erase(num[i]);
        if(i+k<=n)
            sr.insert(num[i+k]);
    }
    priority_queue<int> pq;
    rep(i, 1, n + 1)if (!degree[i])pq.push(i);
    rep(i, 1, n + 1)
    {
        int k = pq.top();
        pq.pop();
        tmp.push_back(k);
        for (int kk:e[k])
        {
            degree[kk]--;
            if (!degree[kk])pq.push(kk);
        }
    }
    reverse(tmp.begin(),tmp.end());
    res.resize(n + 1);
    rep(i,0,n)res[tmp[i]]=i+1;
    rep(i,1,res.size())
        printf("%d\n",res[i]);
}

Measured memory_bytes: 66548
N, K = map(int, input().split())

# print(N, K)
S = input()
index_array = [0]
now_letter = "1"
for i, s in enumerate(S):
    if s != now_letter:
        now_letter = s
        index_array.append(i)
else:
    if now_letter == "1":
        index_array.append(N)
    else:
        index_array.append(N)
        index_array.append(N)        

# print(index_array)
ans = 0
array_len = len(index_array)
if (K + 1) * 2 > array_len:
    print(N)
    exit()
candidate = array_len // 2 - K
for i in range(candidate):
    # print(index_array[(i + K) * 2 + 1] - index_array[i * 2])
    ans = max(index_array[(i + K) * 2 + 1] - index_array[i * 2], ans)
print(int(ans))


Measured memory_bytes: 45680
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    a: i8,
    b: i8,
  }
  
  let mut c = 0;
  for i in 1..1010 {
    if (i as f32 * 0.08) as i8 == a && (i as f32 * 0.1) as i8 == b {
      println!("{}", i);
      return;
    }
  }
  
  println!("-1");
}

Measured memory_bytes: 4352
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,d;
    cin>>n>>d;
    int p[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>p[i][j];
        }
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            //if(i==j)    continue;
            int sum = 0;
            for(int k=0;k<d;k++){
                sum += ((p[i][k]-p[j][k])*(p[i][k]-p[j][k]));
            }
            if(sum==1){
                cnt++;
                continue;
            }
            for(int k=2;k*k<=sum;k++){
                if((sum%k==0) && (k==sum/k)){
                    cnt++;
                    break;
                }
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}



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

const int MAX = 10000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  // 前処理
  COMinit();
  int n;cin >> n;
  vector<int> a(n+1);for(int i=0;i<n+1;i++){cin >> a[i];a[i]-=1;}
  vector<bool> b(n,true);
  for(int i=0;i<n+1;i++){b[a[i]]=!b[a[i]];}
  pair<int,int> p=make_pair(-1,-1);
  for(int i=0;i<n+1;i++){
    if(b[a[i]]){
      if(p.first==-1){p.first=i;}
      else{p.second=i;break;}
    }
  }
  for(int i=1;i<=n+1;i++){
    //cout << (COM(n+1,i)-COM(n+1-(p.second-p.first+1),i-1))%MOD << endl;
    int c=COM(n+1,i)-COM(p.first+(n-p.second),i-1);
    while(c<0){
      c+=MOD;
    }
    cout << c%MOD << endl;

    //cout << COM(p.first+(n-1-p.second),i-1)%MOD << endl;
  }
}


Measured memory_bytes: 236032
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int, int, int> Tuple;
const char *cookie = "ox";
const int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[] = {1, 0, -1, -1, -1, 0, 1, 1};

char grid[10][10];

void show()
{
	for (int i = 1; i <= 8; i++){
		for (int j = 1; j <= 8; j++){
			printf("%c", grid[i][j]);
		}
		puts("");
	}
}

int calc(int turn, int x, int y)
{
	int res = 0;
	for (int dir = 0; dir < 8; dir++){
		int k = 1;
		while (true){
			int nx = x + dx[dir] * k;
			int ny = y + dy[dir] * k;
			if (grid[nx][ny] == '.') break;
			if (grid[nx][ny] == cookie[turn]) break;
			k++;
		}
		if (grid[x + dx[dir] * k][y + dy[dir] * k] == '.') k = 0;
		
		for (int i = 1; i < k; i++){
			int nx = x + dx[dir] * i;
			int ny = y + dy[dir] * i;
			//if (grid[nx][ny] == '.') break;
			//if (grid[nx][ny] == cookie[turn]) break;
			res++;
		}
	}
	return res;
}

void st(int turn, int x, int y)
{
	grid[x][y] = cookie[turn];
	for (int dir = 0; dir < 8; dir++){
		int k = 1;
		while (true){
			int nx = x + dx[dir] * k;
			int ny = y + dy[dir] * k;
			if (grid[nx][ny] == '.') break;
			if (grid[nx][ny] == cookie[turn]) break;
			k++;
		}
		if (grid[x + dx[dir] * k][y + dy[dir] * k] == '.') k = 0;
		
		for (int i = 1; i < k; i++){
			int nx = x + dx[dir] * i;
			int ny = y + dy[dir] * i;
			//if (grid[nx][ny] == '.') break;
			//if (grid[nx][ny] == cookie[turn]) break;
			grid[nx][ny] = cookie[turn];
		}
	}
}

int main()
{
	memset(grid, '.', sizeof(grid));
	for (int i = 1; i <= 8; i++){
		for (int j = 1; j <= 8; j++){
			scanf(" %c", &grid[i][j]);
		}
	}
	
	int turn = 0;
	int pass = 0;
	while (true){
		int sign = turn ? 1 : -1;
		// score, i, j
		Tuple maxi(0, 0, 0);
		for (int i = 1; i <= 8; i++){
			for (int j = 1; j <= 8; j++){
				if (grid[i][j] != '.') continue;
				Tuple t(calc(turn, i, j), i * sign, j * sign);
				maxi = max(maxi, t);
			}
		}
		
		//show();
		if (get<0>(maxi) == 0){
			pass++;
			if (pass >= 2){
				show();
				return 0;
			}
		}
		else {
			st(turn, abs(get<1>(maxi)), abs(get<2>(maxi)));
			pass = 0;
		}
		turn ^= 1;
	}
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

const int MOD = 1e9+7;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  ll ans = 1;
  for (int i = 1; i <= n; i++)
    ans = ans*i%MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*|In The Name of Allah|*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}



void MisSiOn_ImPosSiBlE(){
//freopen("portals.in", "r", stdin);
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

}


int const N = 1e3 + 9, mod = 1e9+7 , oo = 0x3f3f3f3f;
//------------------------------------------------------------------------------------




int arr[N];

int main()
{
    MisSiOn_ImPosSiBlE();

    int n,s=0;
    cin>>n;
    lp(i,n)cin>>arr[i];
    sortaa(arr,n);
    for (int i=0;i<n-1;i++)s+=arr[i];

    if (s>arr[n-1])cout<< "Yes";
    else cout<< "No";






















/*
*/
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    uint64_t X,n=100,i=0;
    cin>>X;

    while(n<X){
        n*=1.01;
        i++;
    }
    cout<<i<<endl;
}

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

using namespace std;

typedef long long ll;

const int MAX_N = 1;

int N;

int main()
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int l, r; cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  int n;
  int id[100];
  double p[100],w[100];
  bool use[100];
  long long int pascal[101][101];

  for(int i=0;i<=100;i++){
    pascal[i][0] = 1;
    pascal[0][i] = 1;
  }

  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++)pascal[i][j] = (pascal[i-1][j] + pascal[i][j-1]) % 100000007;
  }
  
  for(;;){
    scanf("%d",&n);
    if(!n)break;

    for(int i=0;i<n;i++){
      scanf("%lf %d %lf",&p[i],&id[i],&w[i]);
      use[i] = false;
    }

    double ans = 0.0;
    int rem = n;
    long long int pattern = 1;
    for(int i=0;i<n;i++){
      if(!use[i]){
	use[i] = true;
	int tmp = i;
	vector<int> loop;

	loop.push_back(tmp);
	for(;;){
	  tmp = id[tmp];
	  if(tmp==i)break;
	  use[tmp] = true;
	  loop.push_back(tmp);
	}

	int num = 1;
	double m = 1.0/p[loop[0]] - 1.0/w[loop[0]];
	ans += 1.0/w[loop[0]];
	for(int j=1;j<(int)loop.size();j++){
	  ans += 1.0/w[loop[j]];
	  if(abs(m-1.0/p[loop[j]] + 1.0/w[loop[j]])<1e-10){
	    num++;
	  }else if(m > 1.0/p[loop[j]] - 1.0/w[loop[j]]){
	    m = 1.0/p[loop[j]] - 1.0/w[loop[j]];
	    num = 1;
	  }
	}
	ans += m;
	pattern = (pattern * num) % 100000007;
	//cout << rem << " " << loop.size() << " " << pascal[rem-(int)loop.size()][loop.size()] << endl;
	rem -= loop.size();
	pattern = (pattern * pascal[rem][(int)loop.size()]) % 100000007;
      }
    }
    printf("%.11lf %lld\n",ans,pattern);
  }
}

Measured memory_bytes: 0
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    macro_rules! fail {
        () => (puts!("No\n"); return;);
    }
    input! {
        n: usize,
        a: [i64; n],
        b: [i64; n],
    }
    let asum: i64 = a.iter().sum();
    let bsum: i64 = b.iter().sum();
    if asum > bsum {
        fail!();
    }
    let k = bsum - asum;
    let mut neca = 0;
    let mut necb = 0;
    for i in 0..n {
        if a[i] < b[i] {
            let d = b[i] - a[i];
            neca += d / 2 + (d % 2);
            necb += d % 2;
        } else {
            necb += a[i] - b[i];
        }
    }
    if neca > k || necb > k {
        fail!();
    }
    puts!("Yes\n");
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
const int mod=1e9+7;

int main(){
	int a,b,k;
	cin >> a >> b >> k;
	set<int> out;
	for(int i=0; i<k && a+i<=b; i++)
		out.insert(a+i);
	for(int i=0; i<k && b-i>=a; i++)
		out.insert(b-i);
	for(auto e: out) cout << e << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
AB = {}
for n in range(N):
    a, b = list(int(x) for x in input().split())
    if a in AB:
        AB[a] += b
    else:
        AB[a] = b
yen = 0
AB = sorted(AB.items())
for a, b in AB:
    if b <= M:
        yen += a*b 
        M -= b
    else:
        yen += a*M
        M = 0
print(yen)


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

using namespace std;

typedef long long ll;

ll n, x;

int main() {
    scanf("%lld%lld",&n,&x);
    ll a = n-x, b = x, res = n;
    while(a) {
        res += b/a*a*2;
        b%=a;
        swap(a,b);
    }
    printf("%lld\n",res-b);

    return 0;
}


Measured memory_bytes: 256
let l = read_line ();;
let n = String.length l;;

(* dp[n][3][2] *)

let md = 1000000007
let ( +++ ) x y = let z = x + y in if z < md then z else z - md;;
let array2d i j v = Array.init i (fun _ -> Array.make j v);;
let array3d i j k v = Array.init i (fun _ -> array2d j k v);;

let eq = 0;;
let lt = 1;;
let gt = 2;;

let dp = array3d (n+1) 3 2 0;;
let add (i, j, k) v = dp.(i).(j).(k) <- dp.(i).(j).(k) +++ v;;
add (n, eq, 0) 1;;

for i = n-1 downto 0 do 
  for j = 0 to 2 do
    for k = 0 to 1 do
      for x = 0 to 1 do
        for y = 0 to 1 do
          let c = (x + y + k) / 2 in
          let s = (x + y + k) mod 2 in
          let nj = match compare s (Char.code l.[i] - Char.code '0') with
            | -1 -> lt
            | 1 -> gt
            | _ -> j in
          if s = (x + y) mod 2 then
            add (i, nj, c) dp.(i+1).(j).(k)
        done
      done
    done
  done
done;;

let ans = dp.(0).(lt).(0) +++ dp.(0).(eq).(0);;
Printf.printf "%d\n" ans;;


Measured memory_bytes: 14592
/*
ID: zhaowei10
TASK:
LANG: C++14
*/
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
#include <debug.h>
#else
#define debug(...) 0
#endif

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

#ifdef LOCAL
  freopen("test.in", "r", stdin);
  freopen("test.out", "w", stdout);
#else
#endif

  long long a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  long long diff = abs(a - b);
  long long dv = v - w;
  cout << (diff <= dv * t ? "YES" : "NO");
}

Measured memory_bytes: 3608
{-# LANGUAGE TypeApplications #-}

import           Control.Monad
import           Control.Applicative
import           Data.List
import           Data.Char
import           Control.Arrow
import           Data.Bits

main = do
  getLine
  a <- map (read @Int) . words <$> getLine
  let snuke = foldr1 xor a
  putStrLn . unwords . map (show . xor snuke) $ a


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

using namespace std;

#define debug(x) cout << "\n" << __LINE__ << " " <<  (#x) << " is " << (x) << endl

int main(){
	#ifdef EVAL	
		freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	#endif
	int N, D;
	cin >> N >> D;
	cout << N / (D * 2 + 1) + bool(N % (D * 2 + 1));
	return 0;
}

Measured memory_bytes: 256
S = gets.chomp

wk = (/(.).?\1/ =~ S)
if wk.nil? then
  puts [-1, -1] * ' '
else
  if wk+2 == S.size then
    puts [wk+1, wk+2] * ' '
  else
    puts [wk+1, wk+3] * ' '
  end
end


Measured memory_bytes: 1916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		Pair p[] = new Pair[n];

		for (int i = 0; i < n; i++) {
			String str[] = br.readLine().split(" ");

			p[i] = new Pair(Long.parseLong(str[0]), Long.parseLong(str[1]));
		}

		Arrays.sort(p, Comparator.reverseOrder());

		long X = 0;
		long Y = 0;

		for (int i = 0; i < n; i++) {
			if (i % 2 == 0)
				X += p[i].a;
			else
				Y += p[i].b;
		}
		System.out.println(X - Y);
	}
}

class Pair implements Comparable<Pair> {
	long a;
	long b;

	public Pair(long a, long b) {
		this.a = a;
		this.b = b;
	}

	@Override
	public int compareTo(Pair p) {
		long x = a + b;
		long y = p.a + p.b;
		return Long.compare(x, y);
	}
}

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

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

    int cnt = 0;
    int max_cnt = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') {
        cnt++;
      } else {
        max_cnt = max(max_cnt, cnt);
        cnt = 0;
      }
    }

    cout << max(max_cnt, cnt);

    return 0;
}



Measured memory_bytes: 256
from sys import stdin

def judge(S):
	S_list  = list(str(S))  #list化
	
	i_pure = None
	for i in S_list:
		if i == i_pure:
			return 'Bad'
		i_pure = i

	return 'Good'


# S = ['3776','8080','1333','0024']

S = stdin.readline()
# for s in S:
# 	print(judge(s))

print(judge(S))

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#define N 3010
typedef long long ll;
template<typename T> inline void read(T &x) {
	x = 0; char c = getchar();
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}
using namespace std;
const int P = 1e9 + 7;
const int inv2 = 5e8 + 4;
inline ll quickpow(ll x, int k) {
	ll res = 1;
	while (k) {
		if (k & 1)	res = res *x  % P;
		x = x * x % P;
		k >>= 1;
	}
	return res;
}
int n, q;
int a[N];
int f[N][N], g[N][N];
int main() {
	read(n), read(q);
	for (int i = 1; i <= n; ++i)	read(a[i]);
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			f[i][j] = a[i] > a[j];
			f[j][i] = a[j] > a[i];
		}
	}
	for (int i = 1; i <= q; ++i) {
		int l, r; read(l), read(r);
		if (l > r)	swap(l, r);
		int tmp = 1ll * inv2 * (f[l][r] + f[r][l]) % P;
		f[l][r] = f[r][l] = tmp;
		for (int j = 1; j <= n; ++j) if (j != l && j != r) {
			f[j][l] = f[j][r] = 1ll * inv2 * (f[j][l] + f[j][r]) % P;
			f[l][j] = f[r][j] = 1ll * inv2 * (f[l][j] + f[r][j]) % P;
		}
	}
	ll ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			ans = (ans + f[i][j]) % P;
		}
	}
	ans = ans * quickpow(2, q) % P;
	printf("%lld\n", (ans % P + P) % P);
	return 0;
}


Measured memory_bytes: 38480