akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define ll long long

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

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  char s[1010];
  scanf("%s",s);
  int l=strlen(s);
  printf("%s",s);
  if('s'-s[l-1]==0){
    printf("es\n");
  }else{
    printf("s\n");
  }
  return 0;
}

Measured memory_bytes: 1732
import sys

n = int(input())
a = list(map(int, input().split())) 

total = 1
a_sort = sorted(a)
if a_sort[0] == 0:
    print("0")
    sys.exit()

for i in range(n):
    total *= a[i]
    if total > 1000000000000000000:
        print("-1")
        sys.exit()

print(total)

Measured memory_bytes: 21688
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a[i];
  int p,p2=0,p1=abs(a[1]-a[0]);
  for(int i=2;i<n;i++){
    p=min(p1+abs(a[i]-a[i-1]),p2+abs(a[i]-a[i-2]));
    p2=p1;
    p1=p;
  }
  cout<<p1;
}

Measured memory_bytes: 3596
<?php
while( ! feof(STDIN)) {
    $input = trim(fgets(STDIN));
    if ($input == "-1 -1 -1"){
        break;
    } else {
        $array = explode(" ", $input);
        $m = (int)$array[0];
        $f = (int)$array[1];
        $r = (int)$array[2];
        
        if ( $m == -1 || $f == -1 ) {
            echo "F\n";
        } elseif(($m + $f) >= 80) {
            echo "A\n";
        } elseif (($m + $f) < 80 && ($m + $f) >= 65 ) {
            echo "B\n";
        } elseif (($m + $f) < 65 && ($m + $f) >= 50 ) {
            echo "C\n";
        } elseif (($m + $f) < 50 && ($m + $f) >= 30 ) {
            if ($r >= 50) {
                echo "C\n";
            } else {
                echo "D\n";
            }
        } elseif (($m + $f) < 30 ) {
            echo "F\n";
        }
    }
}

Measured memory_bytes: 15272
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,h,w,A[2000],B[2000];
    cin>>n>>h>>w;
    for(int i=0;i<n;i++) cin>>A[i]>>B[i];
    int ans=0;
    for(int i=0;i<n;i++){
        if(A[i]>=h&&B[i]>=w) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public long A, B;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadLongArray();
                A = line[0];
                B = line[1];
            }

            Console.WriteLine(ToX(A-1) ^ ToX(B));

        }

        public long ToX(long x)
        {
            long ret = 0;
            for (int i = 0; i < 64; i++)
            {
                if (i == 0)
                {
                    if ((x % 4) == 1 || (x % 4) == 2)
                        ret += (1L << i);
                }
                else
                {
                    if (((x >> i) & 1) == 1 && x % 2 == 0)
                        ret += (1L << i);
                }
            }

            return ret;

        }


    }

    // libs ----------


    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    int h, w, n;
    cin >> w >> h >> n; // ha?
    V<deque<int>> g(h);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y; x--; y--;
        g[y].push_back(x);
    }
    int ans = w, er = -1;
    for (int y = 0; y < h; y++) {
        auto v = g[y];
        sort(v.begin(), v.end());
        while (v.size() && v.front() <= er) v.pop_front();
        while (v.size() && v.front() == er + 1) {
            er++;
            v.pop_front();
        }
        if (v.size()) ans = min(ans, v.front());
        er++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 134656
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
   int n,k;
   cin>>n>>k;
   int arr[n];
   for(int i=0;i<n;i++)
   cin>>arr[i];
   int dp[n]{};
   for(int i=1;i<n;i++)
   {
       int j=i-2;
       int c=1;
       dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
       while(j>=0 && c<k)
       {
           dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
           j--;
           c++;
       }
   }
   cout<<dp[n-1];

    return 0;
}


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


int main() {

  int a,b;
  string s;
  cin >> a >> b >> s;
  bool flag = 1;
  
  if (s.at(a) != '-')
    flag = 0;
  
  for (int i=0; i<a+b+1; i++){
    
    if (i == a)
      continue;
    
    else
      if (s.at(i) == '-'){
        flag = 0;
        break;
      }
    
  }
  
  if (flag)
    cout << "Yes";
  else
    cout << "No";
    
  return 0;
}

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

int n;

int pay(int an);

int main () {
    scanf("%d", &n);
    printf("%d\n", pay(n));

    return 0;
}

int pay(int an) {
    if (an <= 0) {
        return abs(an);
    }
    an-=1000;
    return pay(an);
}

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

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


	// Algo is quite simple
	string new_string;

	// Create two pointers
	int front  = 0;
	int end = 0;

	for(int i = 0; i  < S.size() ; i++)
	{
		char first_value = S[front];
		if(front < S.size())
		{
			while(S[end] == first_value && end < S.size())
			{
				end++;
			}
			new_string.push_back(first_value);
			front = end;
		}
		
	}


	cout << new_string.size() << endl;

	return 0;
}

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

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>>s(N);
    for(int i = 0; i < N; i++){
        cin >> s.at(i).first;
        cin >> s.at(i).second;
    }
    vector<pair<int, int>>c(M);
    for(int i = 0; i < M; i++){
        cin >> c.at(i).first;
        cin >> c.at(i).second;
    }

    for(int i = 0; i < N; i++){
        int min_length = abs(s.at(i).first - c.at(0).first) + abs(s.at(i).second - c.at(0).second);
        int checkpoint = 1;
        for(int j = 0; j < M; j++){
            const int length = abs(s.at(i).first - c.at(j).first) +  abs(s.at(i).second - c.at(j).second);
            if(min_length > length){
                min_length = length;
                checkpoint = j + 1;
            }
        }
        cout << checkpoint << endl;
    }

    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const double pi=3.1415926535898;
int main()
{
    fastio;
    ll k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()<=k)
    {
        cout<<s;
    }
    else
    {
        string s1=s.substr(0,k);
        s1+="...";
        cout<<s1;
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

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

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

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 2e5 + 10;
int p[N];
vector<int> ch[N];
int ptr[N];
deque<ll> dp[N];

ll Pow(ll a, ll b) {
    ll x = 1, y = a;
    while (b) {
        if (b & 1) (x *= y) %= MOD;
        (y *= y) %= MOD;
        b /= 2;
    }
    return x;
}

ll Inv(ll a) {
    assert(a % MOD);
    return Pow(a, MOD - 2);
}
/*
ll combine(ll x, ll y) {
    ll ans = x + y - 2 * x * y;
    ans %= MOD;
    if (ans < 0) ans += MOD;
    return ans;
}
*/
const ll INV_2 = (MOD + 1) / 2;
void dfs(int u) {
    /*
    ll val = Inv(ll(ch[u].size())) * dp[u] % MOD;
    for (int v : ch[u]) {
        dp[v] = val;
        dfs(v);
    }*/
    ptr[u] = u;
    int max_sz = -1, son = -1;
    for (int v : ch[u]) {
        dfs(v);
        if ((int)dp[ptr[v]].size() > max_sz) {
            max_sz = dp[ptr[v]].size();
            son = v;
        }
    }
    if (son != -1)
        ptr[u] = ptr[son];
    //cerr << u << ' ' << son << ' ' << dp[ptr[u]].size() << '\n';
    int snd = -1;
    for (int v : ch[u]) {
        if (v == son) continue;
        setmax(snd, (int)dp[ptr[v]].size());
    }
    if (snd == -1) {
        dp[ptr[u]].push_front(INV_2);
        return;
    }
    vector<ll> sums(snd), prod(snd, 1);
    for (int v : ch[u]) {
        forn(i, 0, snd) {
            if (i >= (int)dp[ptr[v]].size())
                continue;
            ll p = dp[ptr[v]][i];
            sums[i] += p * Inv(1 - p + MOD);
            sums[i] %= MOD;
            prod[i] *= (1 - p + MOD);
            prod[i] %= MOD;
        }
    }
    forn(i, 0, snd)
        dp[ptr[u]][i] = sums[i] * prod[i] % MOD;
/*
    for (int v : ch[u]) {
        if (v == son) continue;
        assert(dp[ptr[v]].size() <= dp[ptr[u]].size());
        forn(i, 0, dp[ptr[v]].size()) {
            combine(dp[ptr[u]][i], dp[ptr[v]][i]);
        }
    }
*/
    dp[ptr[u]].push_front(INV_2);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    fore(i, 1, n) {
        cin >> p[i];
        ch[p[i]].eb(i);
    }
    dfs(0);
    //trace(dp[ptr[0]]);
    ll ans = accumulate(all(dp[ptr[0]]), 0ll) % MOD;
    cout << ans * Pow(2, n + 1) % MOD << '\n';
}


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

#define ll long long
#define ull unsigned long long

int k;

void solve() {
    cin >> k;
    if(400<=k&&k<=599)
        puts("8");
    else if(600<=k&&k<=799)
        puts("7");
    else if(800<=k&&k<=999)
        puts("6");
    else if(1000<=k&&k<=1199)
        puts("5");
    else if(1200<=k&&k<=1399)
        puts("4");
    else if(1400<=k&&k<=1599)
        puts("3");
    else if(1600<=k&&k<=1799)
        puts("2");
    else
        puts("1");
}

int main() {
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

Measured memory_bytes: 3656
n,a,b,c,d = gets.split.map(&:to_i)

s = gets.chomp


if s[[a,b].min-1...[c,d].max] =~ /##/
	puts "No"
elsif (a < b && c < d) || (a > b && c > d)
	puts "Yes"
elsif s[[a,b].max-2...[c,d].min+1] =~ /\.\.\./
	puts "Yes"
else
	puts "No"
end




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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e8;

//---main---------------------------------------------
int main(){
    //main
    int X;
    cin >> X;

    if(X>=30) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
int power(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int main(){ 
	ll a,b,c;
	cin>>a>>b>>c;
	ll z=min(b-1,c);
	ll ans=(a*z)/b;
	ans-=a*(z/b); 
	cout<<ans<<endl;
}



Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){

    int N;
    cin>>N;

    string s1,s2;cin>>s1>>s2;

    LL ans=1;
    LL INF = 1000000007;

    int cnt=0;
    bool isVer=false;
    while(cnt<N){
        if(s1[cnt]!=s2[cnt]){
            if(cnt==0){
                ans=6;
            }else if(isVer){
                ans*=2;
                ans %=INF;
            }else{
                ans *=3;
                ans %=INF;
            }
            isVer=false;
            cnt++;cnt++;
        }else{
            if(cnt==0){
                ans=3;
            }else if(isVer){
                ans *=2;
                ans%=INF;
            }else{
            }
            isVer=true;
            cnt++;
        }
    }

    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
ac = bc = oc = abc = 0
while 1:
	try: n, bt = input().split(",")
	except: break
	if bt == "A": ac += 1
	elif bt == "B": bc += 1
	elif bt == "O": oc += 1
	elif bt == "AB": abc +=1
print(ac)
print(bc)
print(abc)
print(oc)


Measured memory_bytes: 5556
// HTTF.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "bits/stdc++.h"
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
//不可解すぎるバグは配列外参照（配列の長さ）を検討

#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define int LL
#define pb emplace_back
#define eb pb

using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr, greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5 * 1e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 400;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const ld INF = 1e18;
const long double EPS = 1e-7;
const int X = 1;
const int Y = 0;
typedef pair<ld, ut> pld;
ut N, M, K, L, Q, D,H,W;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE], maps2[SIZE2][SIZE2], answer = zero;
LL maps[SIZE2][SIZE2];
LL A, B;
deque<int> obs[SIZE];
LL solve() {
	string s;
	cin >> s;
	LL ans = 0, times = 0;
	REP(i, s.size()) {
		if (s[i] == 'B') {
			times++;
		}
		else {
			ans += times;
		}
	}
	cout << ans << endl;
	return 0;
}
signed main() {
	solve();
	cin >> N;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 352512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    // +-+-+-
    ll ans1, b1;
    if(a[0] > 0){
        ans1 = 0;
        b1 = a[0];
    }else{
        ans1 = -a[0] + 1;
        b1 = 1;
    }
    repr(i, 1, n){
        if(b1 > 0){
            if(a[i] + b1 < 0){
                b1 += a[i];
            }else{
                ans1 += a[i] + b1 + 1;
                b1 = -1;
            }
        }else{
            if(a[i] + b1 > 0){
                b1 += a[i];
            }else{
                ans1 += -a[i] - b1 + 1;
                b1 = 1;
            }
        }
        //dump2(b1, ans1);
    }
    // -+-+-+
    ll ans2, b2;
    if(a[0] < 0){
        ans2 = 0;
        b2 = a[0];
    }else{
        ans2 = a[0] + 1;
        b2 = -1;
    }
    repr(i, 1, n){
        if(b2 > 0){
            if(a[i] + b2 < 0){
                b2 += a[i];
            }else{
                ans2 += a[i] + b2 + 1;
                b2 = -1;
            }
        }else{
            if(a[i] + b2 > 0){
                b2 += a[i];
            }else{
                ans2 += -a[i] - b2 + 1;
                b2 = 1;
            }
        }
    }
    //dump2(ans1, ans2);
    cout << min(ans1, ans2) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
	return 0;
 } 

Measured memory_bytes: 3620
#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)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  rep(i, n) {
    if ((int)s[i] == i%2+48 ) ans++;
  }
  cout << min(ans, n-ans) << endl;
}

Measured memory_bytes: 512
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,x = readInts()
xs = readInts()
xs.append(x)
xs.sort()

ans = xs[1]-xs[0]
for i in range(n):
  ans = math.gcd(ans,xs[i+1]-xs[i])

print(ans)

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

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

bool kaibun(string s){
    int n = s.size();
    if(n%2==1){
        n ++;
    }
    n /= 2;
    
    bool ok = true;
    for(int i = 0; i < n; i++){
        if(s[i]!=s[s.size()-i-1]){
            ok = false;
            break;
        }
    }
    return ok;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();

    bool ok = true;
    if(!kaibun(s)){
        cout << "No" << endl;
        return 0;
    }
    if(!kaibun(s.substr(0,(n-1)/2 ))){
        cout << "No" << endl;
        return 0;       
    }
    if(!kaibun(s.substr((n+3)/2-1, (n-3)/2+1))){
        cout << "No" << endl;
        return 0;
    }

    // cout << s.substr(0,(n-1)/2 ) << endl;
    // cout << s.substr((n+3)/2-1, (n-3)/2+1) << endl;

    cout << "Yes" << endl;

    return 0;
}  

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<bitset>
#include<deque>
#include<iterator>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include <cmath>
#include<vector>
using namespace std;
#define pb push_back
#define pf push_front
#define M 1000000007
#define ll long long int
int main()
 {
 	 
     ll n,m;
     cin>>n>>m;
     ll arr[m],i;
     ll sum=0;
     for(i=0;i<m;i++)
     	{cin>>arr[i];sum+=arr[i];}
     if(n>=sum)
      cout<<n-sum;
  else
  	cout<<-1;
    
     return 0;
 }

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

int main(){
    int n;
    cin >> n;
    char c;
    int num;
    vector<int> v(53,0);
    for(int i=1; i<=n; i++){
        cin >> c >> num;
        int t;
        if(c=='S') t=0;
        else if(c=='H') t=1;
        else if(c=='C') t=2;
        else if(c=='D') t=3;
        v[13*t+num]++;
    }
    for(int i=1; i<=52; i++){
        switch((i-1)/13){
            case 0: c='S'; break;
            case 1: c='H'; break;
            case 2: c='C'; break;
            case 3: c='D'; break;
        }
        if(v[i]==0){
            if(i%13==0)
                cout << c << " " << "13" << endl;
            else
                cout << c << " " << (i%13) << endl;
        }
    }
    return 0;
}


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

using namespace std;

int main()
{
	double x1, y1, x2, y2, calc = 0;
	
	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
	
	calc = sqrt(pow((x1-x2), 2)+pow((y1-y2), 2));
	
	printf("%.8lf\n", calc);
	
	return 0;
}


Measured memory_bytes: 3208
#include<stdio.h>

int main(){

  int n,q,i,j,k,C=0,m,r,l;
  int S[100000];
  int T[50000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }


    for(i=0;i<q;i++){
      r=n;
      l=0;
      while(l<r){
	m=(r+l)/2;
	if(S[m]>T[i]){ 
	  r=m;
	  continue;
	}
	  else if(S[m]<T[i]){
	    l=m+1;
	    continue;
	  }
	  else {
	  C++;
	  break;
	}
	
    }
    }
  printf("%d\n",C);
  return 0;
}



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

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define allpt(v) (v).begin(), (v).end()


const int mod = 1e9 + 7;
const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(vector<T> v)
{
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;
    return;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, p;
    cin >> n;
    vector<int> x(n), ans(n * n, -1);
    vector<int> prepare, postpare, fillvec, appear(n, 0), check(n, 0);
    vector<PII> y(n);
    rep(i, n)
    {
        cin >> x[i];
        y[i] = make_pair(x[i], i + 1);
        ans[x[i] - 1] = i + 1;
    }
    sort(allpt(y));

    for (auto z : y)
    {
        rep(j, z.second - 1)
            prepare.push_back(z.second);
        rep(j, n - z.second)
            postpare.push_back(z.second);
    }

    for (auto z : prepare)
        fillvec.push_back(z);
    for (auto z : postpare)
        fillvec.push_back(z);

    p = 0;
    rep(i, n * n)
    {
        if (ans[i] == -1)
        {
            ans[i] = fillvec[p];
            p++;
        }
    }

    rep(i, n * n)
    {
        appear[ans[i] - 1]++;
        if (appear[ans[i] - 1] == ans[i])
        {
            if (i + 1 == x[ans[i] - 1])
                check[ans[i] - 1] = 1;
            else
                check[ans[i] - 1] = -1;
        }
    }

    if (accumulate(allpt(check), 0) == n)
    {
        cout << "Yes" << rt;
        show1dvec(ans);
    }
    else
        cout << "No" << rt;


    return 0;
}


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

int main(void){
    int N;
    cin>>N;
    vector<string> s(N);
    for(int i=0;i<N;i++){
        cin>>s[i];
    }
    int M;
    cin>>M;
    vector<string>t(M);
    for(int i=0;i<M;i++){
        cin>>t[i];
    }
    int ans=0;
    map<string,int> sum;
    for(int i=0;i<N;i++){
        sum[s[i]]++;
    }
    for(int i=0;i<M;i++){
        sum[t[i]]--;
    }
    for(auto result:sum){
        ans=max(ans,result.second);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define MAX 4003
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) cout<<"Case #"<<i<<": "
#define pf(a) printf("%lld\n",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define pfff(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pffff(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v1,v2,dummy;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz,maxi;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
vector<ll>power;
int main()
{
    string s;
    cin>>s;
    if(s=="Sunny") cout<<"Cloudy"<<endl;
    else if(s=="Cloudy") cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;
    return 0;
}
/*
5
4
3
2
3
4
4
3
3
4
2
3
*/


Measured memory_bytes: 256
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define ford(i,a,b) for(int i=b;i>=a;i--)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
 
map<int,int> m1,m2;

signed main()
{
 
    fast;
    int n;
    cin >> n;
    loop(i,n){
    	int x;
    	cin >> x;
    	m1[x-i]++;
    	m2[-1*(x+i)]++;
    }
    int ans=0;
    for(auto i:m1){
    	ans+=(m2[i.ff]*i.ss);
    }
    cout<<ans;
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 37900
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  string c; cin >> c;
  
  int i = 0, j = N-1;
  
  int ans = 0;
  while(true) {
    while(c[i] == 'R') i++;
    while(c[j] == 'W') j--;
    if(i >= j) break;
    
    ans++;
    i++;
    j--;
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 3752
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
   input! {
      n:usize
   }
   let n = n % 10;
   println!(
      "{}",
      match n {
         2 => "hon",
         4 => "hon",
         5 => "hon",
         7 => "hon",
         9 => "hon",
         0 => "pon",
         1 => "pon",
         6 => "pon",
         8 => "pon",
         _ => "bon",
      }
   );
}


Measured memory_bytes: 2116
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int n;
	cin >> n;
	int a[100000];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int> v;
	for (int i = 0; i < n; i++) {
		if (v.size() == 0 || v[v.size() - 1] >= a[i]) {
			v.push_back(a[i]);
		} else {
			int l = -1, r = v.size() - 1;
			while (r - l > 1) {
				int m = (l + r) / 2;
				if (v[m] < a[i])
					r = m;
				else
					l = m;
			}
			v[r] = a[i];
		}
	}
	cout << v.size() << endl;
}

Measured memory_bytes: 1276
import java.util.Scanner;

class MOD {
    static final int mod = 1000000007;

    static int add(int a, int b){
        int x = a + b;
        return (x >= mod) ? x - mod : x;
    }

    static int sub(int a, int b){
        int x = a - b;
        return (x < 0) ? x + mod : x;
    }

    static int mul(int a, int b){
        long x = (long)a * (long)b;
        return (int)(x % mod);
    }

    static int div(int a, int b){
        return mul(a, modinv(b));
    }

    static int modinv(int a) {
        int b = mod;
        int u = 1;
        int v = 0;
        while (b != 0) {
            int t = a / b;
            a -= t * b;
            int temp = a; a = b; b = temp; // swap(a, b)
            u -= t * v;
            temp = u; u = v; v = temp; // swap(u, v)
        }
        u %= mod;
        if (u < 0) u += mod;
        return u;
    }
}

class MODnCk {
    private static final int mod = 1000000007;

    private static int[] factorialCache = new int[16000];
    private static int factorialCacheIdx = 0;

    static{
        factorialCache[0] = 1;
    }
    
    static int nCk(int n, int k){
        return div((div(factorial(n), factorial(k))), factorial(n-k));
    }

    private static int factorial(int n){
        if(factorialCacheIdx < n){
            setFactorialCache(factorialCacheIdx+1, n);
        }

        return factorialCache[n];
    }

    private static void setFactorialCache(int s, int e){
        for(int i=s; i<=e; i++){
            factorialCache[i] = mul(factorialCache[i-1], i);
        }
        factorialCacheIdx = e;
    }

    private static int div(int a, int b){
        return mul(a, modinv(b));
    }

    private static int mul(int a, int b){
        long x = (long)a * (long)b;
        return (int)(x % mod);
    }

    private static int modinv(int a) {
        int b = mod;
        int u = 1;
        int v = 0;
        while (b != 0) {
            int t = a / b;
            a -= t * b;
            int temp = a; a = b; b = temp; // swap(a, b)
            u -= t * v;
            temp = u; u = v; v = temp; // swap(u, v)
        }
        u %= mod;
        if (u < 0) u += mod;
        return u;
    }
}

public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int s = stdIn.nextInt();

        int maxDigit = s / 3;
        int sum = 0;
        for(int i=1; i<=maxDigit; i++){
            sum = MOD.add(sum, patternOfShowNByK(s, i));
        }
        
        System.out.println(sum);
    }

    static int patternOfShowNByK(int n, int k){
        return MODnCk.nCk(n - 2 * k - 1, k - 1);
    }
}

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

const int mod = 1000000007;
//const int mod = 998244353;
const int INF = 1001001001;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    ll n;
    cin >> n;
    string s = to_string(n);
    bool flag = true;
    rep(i, 1, s.size()){
        if(s[i] == '9') continue;
        flag = false;
    }
    if(flag) {
        cout << (s.size()-1)*9 + s[0] - '0' << endl;
        return 0;
    }
    if(s[0] != '1') cout << 9*(s.size()-1) + (s[0] - '1') << endl;
    else cout << 9*(s.size()-1) << endl;
    return 0;
}


Measured memory_bytes: 3688
//In The Name Of GOD

#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll mod = 1000000007;
const ll inf = 2000000000;
const ll infll = (ll)2*1000*1000*1000*1000*1000*1000;
const ll maxn = 20;
#define pb push_back
#define pp pop_back
#define IO ios_base::sync_with_stdio(false);

int main(){
  IO;
  int n;
  ll man=0,mos=0;
  cin>>n;
  ll A[n],B[n];
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  for(int i=0;i<n;i++){
    cin>>B[i];
  }
  for(int i=0;i<n;i++){
    if(A[i]>B[i]){
      mos+=(A[i]-B[i]);
    }else{
      man+=(B[i]-A[i])/2;
    }
  }
  cout<<(((ll)mos<=man)? "Yes" : "No");
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
#include <time.h>
using namespace std;
int main() {
	string s;
	long long int n;
	cin >> s;
	cin >> n;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] + n > 'z'&&s[i] != 'a') {
			n -= 'z' - s[i] + 1;
			s[i] = 'a';
		}
	}
	s[s.size() - 1] += n % 26;
	cout << s << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N,M;
    cin >> N >> M;
    
    vvi G(N);
    
    rep(i,M){
        int a,b;
        cin >> a >> b;
        a--,b--;
        
        G[a].pb(b);
        G[b].pb(a);
    }
    
    queue<int> A;
    vi ans(N,-1);
    
    A.push(0);
    ans[0] = 0;
    
    while (!A.empty()) {
        int a = A.front();
        A.pop();
        
        for (int p : G[a]) {
            if(ans[p] != -1) continue;
            ans[p] = a+1;
            A.push(p);
        }
    }
    
    //outve(ans);
    
    
    bool f = true;
    reps(i,1,N) if(ans[i] == -1) f = false;
    if(f) {
        cyes;
        reps(i,1,N) cout << ans[i] << endl;
    }else{
        cno;
    }
    
    
    

    return 0;
}


Measured memory_bytes: 10288
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main(){
	int x,a;
	cin>>x>>a;
	if(x<a){
		cout<<0<<endl;
	}		
	else{
		cout<<10<<endl;
	}
}


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

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

using namespace std;

int main(){
  int N, A, B;
  string s;
  cin >> N >>A>>B;
  cin >> s;

  int a = 0, b=0;
  rep(i,s.size()){
    if(s[i]=='a'){
      if(a+b < A+B){
        ++a;
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
    }else if(s[i]=='b'){
      if(a+b < A+B && b < B){
        ++b;
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
    }else{
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 896
p=print
b=0
for e in iter(input,'0 0'):
 if b:p()
 b=u=1;s,t=e.split()
 for y in range(int(s),int(t)+1):
  if((y%4==0)*(y%100!=0)or y%400==0):p(y);u=0
 if u:p('NA')


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

using namespace std;

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

    vector<string> list(N);

    for(auto& e : list) {
        cin >> e;
    }

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

    cout << accumulate(list.begin(), list.end(), string(""), [](string a, string b) { return a + b; }) << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np

# input
N = int(input())
s = []
for _ in range(N):
    s.append( input() )

# Step.1
count = 0
for string in s:
    count += string.count("AB")

# Step.2
s_ba, s_oa, s_bo = [], [], []
## sort
for string in s:
    if string[0] == "B":
        if string[-1:] == "A": 
            s_ba.append(string)
        else:
            s_bo.append(string)
    elif string[-1:] == "A":
        s_oa.append(string)

#print(s_oa)
#print(s_ba)
#print(s_bo)

## solve
element = 0
if len(s_oa) != 0: 
    s_oa.pop(0)
    element += 1

element += len(s_ba)

if len(s_bo) != 0: 
    s_bo.pop(0)
    element += 1

element += min(len(s_bo), len(s_oa))

if element != 0:
    count += element - 1

print(count)


Measured memory_bytes: 14408
package main

import (
	"fmt"
	"math"
)

func main() {
	var h float64
	fmt.Scan(&h)

	result := 0
	for i := 1; i < int(h); i++ {
		num := int(float64(h) / math.Pow(2, float64(i)))
		//fmt.Println(num)
		if num <= 1 {
			result = i
			break
		}
	}
	ans := 0.0
	for i := 0; i <= result; i++ {
		ans += math.Pow(2, float64(i))

	}
	fmt.Println(int(ans))

}


Measured memory_bytes: 512
// Created by AboAbdoMC
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long

using namespace std;
using namespace __gnu_pbds;

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

const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 1e2+7;

double x[N],y[N];
int n;

double f()
{
	vector<pair<double,double> > vec;
	vec.pb({0,0});
	rep(i,n)
	{
		vector<pair<double,double> > vec2;
		for(auto p:vec)
		{
			vec2.pb(p);
			vec2.pb({p.f+x[i],p.s+y[i]});
		}

		sort(vec2.begin(), vec2.end());
		reverse(vec2.begin(), vec2.end());
		vec.clear();
		for(auto p:vec2)
		{
			if (vec.size() == 0||p.f > vec[vec.size()-1].f || p.s > vec[vec.size()-1].s) vec.pb(p);
		}
	}

	double ret = 0;
	for(auto p:vec) ret = max(ret,sqrt(p.f*p.f+p.s*p.s));

	return ret;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n;
    rep(i,n) cin >> x[i] >> y[i];
    double ans = f();
    rep(i,n) x[i] *= -1;
    ans = max(ans,f());
    rep(i,n) y[i] *= -1;
    ans = max(ans,f());
    rep(i,n) x[i] *= -1;
    ans = max(ans,f());

    cout << fixed << setprecision(10);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 10060
/**
 * @brief AtCoder Regular Contest 061<br>
 * C- たくさんの数式 / Many Formulas
 *
 * bit全検索パターン
 * @see https://arc061.contest.atcoder.jp/tasks/arc061_a
 */
#include <iostream>
using namespace std;

constexpr unsigned BIT = 1;

int main() {
  string S;
  cin >> S;
  size_t len{S.size()};

  long total{};
  for (size_t i{}; i < (BIT << (len - 1)); ++i) {
    long temp = S[0] & 0xF;
    for (size_t j{}; j < len - 1; ++j) {
      if (i & (BIT << j)) {
        total += temp;
        temp = 0;
      }
      temp *= 10;
      temp += S[j + 1] & 0xF;
    }
    total += temp;
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
S = input()

ans = S.count('R') * S.count('G') * S.count('B')

for i in range(n-2):
    for j in range(i+1,n-1):
        if 2*j-i >= n:
            break
        elif S[i] != S[j] and S[j]!=S[2*j-i] and S[i] != S[2*j-i]:
            ans -=1

print(ans)

Measured memory_bytes: 9140
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    class P implements Comparable<P> {
        int value;
        int index;

        @Override
        public int compareTo(P o) {
            if (o.value != value) {
                return value < o.value ? -1 : 1;
            }
            if (o.index != index) {
                return index > o.index ? -1 : 1;
            }
            return 0;
        }

        @Override
        public String toString() {
            return "{" + value + ", " + index + "}";
        }
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<P> set = new TreeSet<>();
        for (int i = 0; i < n; ++i) {
            int v = sc.nextInt();
            P p = new P();
            p.value = v;
            p.index = i;
            P q = set.lower(p);
            if (q != null) {
                set.remove(q);
            }
            set.add(p);
            // System.err.println(set);
        }
        System.out.println(set.size());
    }

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


Measured memory_bytes: 67860
#062-C
h,w=map(int,input().split())
ans=float('inf')
for i in range(1,h):
    a=i*w
    b1=(h-i)//2*w
    c1=(h-i-(h-i)//2)*w
    b2=(h-i)*(w//2)
    c2=(h-i)*(w-w//2)
    can1=max(a,b1,c1)-min(a,b1,c1)
    can2=max(a,b2,c2)-min(a,b2,c2)
    ans=min(ans,can1,can2)
for i in range(1,w):
    a=i*h
    b1=(w-i)//2*h
    c1=(w-i-(w-i)//2)*h
    b2=(w-i)*(h//2)
    c2=(w-i)*(h-h//2)
    can1=max(a,b1,c1)-min(a,b1,c1)
    can2=max(a,b2,c2)-min(a,b2,c2)
    ans=min(ans,can1,can2)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
//#include <tuple>
#include <set>
#include <string.h>
#include <functional>

#define X first
#define Y second
#define MP make_pair
//#define MT make_tuple
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
#define FOR(i, n) REP(i, 0, n)
typedef long long ll;
using namespace std;
const int MAX = 101;

template<class T, class U>
void convert(T &t, U &u)
{
	stringstream ss;
	ss << t;
	ss >> u;
}

int dp[1001][1001];

int main()
{
	int n;
	while ( cin >> n && n ){
		memset(dp, 0, sizeof(dp));
		//入力.
		vector<pair<int, int> > data;
		FOR( i, n ){
			int s, t; cin >> s >> t;
			data.push_back( MP( s, t ) );
		}

		int m; cin >> m;
		FOR( i, m ){
			int s, t; cin >> s >> t;
			data.push_back( MP( s, t ) );
		}
		
		sort(data.begin(), data.end());


		dp[data[0].first][data[0].second] = 1;
		FOR(i, data.size()){
			REP(j, i + 1, data.size()){
				if (data[i].first < data[j].first && data[i].second < data[j].second){
					dp[data[j].first][data[j].second] = max(dp[data[j].first][data[j].second], dp[data[i].first][data[i].second] + 1);
				}
			}
		}

		int maxc = -1;
		FOR(i, data.size()){
			maxc = max(maxc, dp[data[i].first][data[i].second]);
		}

		cout << maxc << endl;
	}
	return 0;
}

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

int main() {
  string s;
  int y=0;
  cin >> s;
  y = 700;
  if(s[0] == 'o') y += 100;
  if(s[1] == 'o') y += 100;
  if(s[2] == 'o') y += 100;
  cout << y << endl;
}


Measured memory_bytes: 256