akhauriyash/Code-Regression huggingface dataset:
<?php
fscanf(STDIN, "%d%d", $H, $W);
for($y = 0; $y < $H; $y++){
    $map[$y] = explode(" ", trim(fgets(STDIN)));
}
$ret = [];
for($y = 0; $y < $H; $y++){
    if($y % 2 == 0){
        for($x = 0; $x < $W; $x++){
            if($map[$y][$x] % 2 == 1){
                $map[$y][$x]--;
                if($x<$W-1){
                    $map[$y][$x+1]++;
                    $ret[] = implode(" ", [$y+1,$x+1,$y+1,$x+2]);
                }else{
                    if($y+1==$H)break;
                    $map[$y+1][$x]++;
                    $ret[] = implode(" ", [$y+1,$x+1,$y+2,$x+1]);
                }
            }
        }
    }else{
        for($x = $W - 1; $x >= 0; $x--){
            if($map[$y][$x] % 2 == 1){
                $map[$y][$x]--;
                if($x>0){
                    $map[$y][$x-1]++;
                    $ret[] = implode(" ", [$y+1,$x+1,$y+1,$x+0]);
                }else{
                    if($y+1==$H)break;
                    $map[$y+1][$x]++;
                    $ret[] = implode(" ", [$y+1,$x+1,$y+2,$x+1]);
                }
            }
        }
        
    }
}
echo count($ret);
echo "\n";
echo implode("\n", $ret);

Measured memory_bytes: 35316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }



int main() {
  string s;
  cin >> s;
  int ans = 0;
  while(1){
    int n = s.length()-1;
    if(n<1) break;

    if(s[0]==s[n]){
      s.erase(s.begin());
      s.pop_back();
    }
    else if(s[0]=='x'){
      s.push_back('x');
      ++ans;
    }
    else if(s[n]=='x'){
      s.insert(s.begin(),'x');
      ++ans;
    }
    else{
      cout << -1 << endl;
      return 0;
    }

    // cout << l << " " << s << endl;
  }

  cout << ans << endl;

}



Measured memory_bytes: 512
def no_dislike_number(num, D):
    for dislike in D:
        if dislike in num:
            return False
    return True

MAX = 10000
N, K = map(int, input().split())
D = input().split()
num = N
while(True):
    if no_dislike_number(str(num), D):
        print(num)
        break
    num += 1

Measured memory_bytes: 7396
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE d(n); rep(i, n)cin >> d[i];
	int ans = 0;
	rep(i, n) {
		rep(j, n) {
			if (i >= j)continue;
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main(){
  int D,N;
  cin >> D >> N;
  int Ans = 1;
  int x = 1;
  for(int i = 0; i < D; i++) Ans *= 100, x *= 100;
  Ans *= N;
  if(N==100) Ans += x;  
  printf("%d\n",Ans );
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const LL N = 1e5 + 5;

using namespace std ;

LD ans[3001][3001];

int main (){
    int n;
    cin >> n;
    LD prob[n + 1];
    for (int i = 1; i <= n; ++i)
        cin >> prob[i];

    ans[1][0] = 1 - prob[1];
    ans[1][1] = prob[1];
    for (int i = 1; i <= n ; ++i){
        for (int j = 0; j <= i; ++j){
            ans[i][j] += ans[i - 1][j] * (1 - prob[i]);
            if (j)
                ans[i][j] += (ans[i - 1][j - 1] * prob[i]);
        }
    }
    LD Ans = 0;
    for (int i = (n + 1) / 2; i <= n; ++i)
        Ans += ans[n][i];
    cout << fixed << setprecision(12) << Ans << endl;
}

//int binarySearch(int start, int End, int Find)
//{
//    if (End >= start) {
//        int mid = start + (End - start) / 2;
//
//        if (arr[mid] >= Find)
//            return mid;
//
//        if (arr[mid] < Find)
//            return binarySearch(mid + 1, End, Find);
//    }
//    return -1;
//}
//int main (){
//    int n;
//    cin >> n;
//    vector <int> vec;
//    for(int i = 0; i < n; ++i)
//        cin >> arr[i];
//    for (int i = 0; i < n; ++i){
//        int cnt = binarySearch(0, n - 1, (arr[i] * 2));
//        cout << arr[i] << " " << cnt << endl;
//    }
//    sort(vec.rbegin(), vec.rend());
//    if (vec[0] == -1) cout << 1 << endl;
//    else cout << vec[0] << endl;
//}

//LL arr[502][502];
//LL trns[502][502];
////scanf("%lld", &n); // long long, int &d, double &lf
////printf("%lld", n);
//void Transpose(LL n, LL m){
//    for (int i = 0; i < n; ++i)
//        for (int j = 0; j < m; ++j)
//                trns[j][i] = arr[i][j];
//
//}
//
//LL primeFact(int n){
//    set <int> st;
//    for (int i = 3 ; i <= n ; i += 2){
//            while(n % 2 == 0){
//                st.insert(2);
//                n /= 2;
//            }
//    }
//    for (int i = 3 ; i <= n ; i += 2){
//            while(n % i == 0){
//                st.insert(i);
//                n /= i;
//            }
//    }
//    if (n > 1)
//        st.insert(n);
//    return st.size();
//}
//
//
//LL GCD(LL a, LL b){
//    if (b == 0) return a;
//    return GCD(b, a % b);
//}
//
//LL cntr = 0;
//LL GCDcntr (LL a, LL b){
//    if (b == 0) return cntr;
//    cntr += (a / b);
//    return GCDcntr(b, a % b);
//}
//
//LL* MaximumAlgorithm (LL arr[], LL n){ // mx[i] : max from arr[0] to i
//    LL maxi = 0;
//    LL* mx = new LL[n];
//    for (LL i = 0; i < n; ++i){
//        for (LL j = 0; j <= i; ++j){
//            if (maxi <= arr[j]) maxi = arr[j];
//        }
//        mx[i] = maxi;
//    }
//    return mx;
//}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a < 9 && b < 9) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)


typedef map<string, int> map_type;
typedef pair<string, int> value_type;

struct second_order {
  bool operator()(const value_type& x, const value_type& y) const {
    if( x.second != y.second) return x.second < y.second;
    return x.first > y.first;
  }
};

typedef priority_queue<value_type, vector<value_type>, second_order> pqueue_type;


pqueue_type map_to_pqueue(map_type m) {
    pqueue_type que;
    for(auto it=m.begin(); it!=m.end(); ++it) {
        que.push(*it);
    }
    return que;
}


int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    
    cout << accumulate(ALL(a), 0) - n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) accumulate(v.begin(),v.end(),0)
#define OUT(n) (cout << n << endl)
using namespace std;
typedef long long ll;

int main(){
  ll n,m;
  cin>>n>>m;
  vector<int>syukudai(m);
  REP(i,m){
    cin >> syukudai.at(i);
  }
  ll ans = 0;
  ans = n -(ALL(syukudai));
  if (ans >= 0){
    cout << ans << endl;
  }
  else
  {
    OUT(-1);
  }
  
}

Measured memory_bytes: 3684
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! {
        n: usize,
        mut plan: [(i32, i32, i32); n],  // Vec<(i32, i32, i32)>
    }
 */
    input! {
        n:usize,
        ds:[usize;n],
    }
    let mut ds = ds;
    ds.sort();
    let middle_pos = n / 2;
    let pre_last = ds[middle_pos - 1];
    let suffix_first = ds[middle_pos];
    if pre_last == suffix_first {
        println!("0");
        return;
    }
    println!("{}",suffix_first - pre_last);


}    


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

using namespace std;

int main() {
    vector<int> v(5);
    for (auto &vi: v) {
        cin >> vi;
    }
    sort(v.begin(), v.end());

    int k;
    cin >> k;
    if (v[4] - v[0] <= k) {
        cout << "Yay!";
    }  else {
        cout << ":(";
    }
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

min_m = -10**9+1
min_p = 10**9+1 
ans = 0
cnt = 0

for i in range(n):
  ans += abs(a[i])
  if min_p > a[i] >= 0:
    min_p = a[i]
  elif a[i] < 0:
    if min_m < a[i]:
      min_m = a[i]
    cnt += 1
if cnt % 2:
  if abs(min_m) > abs(min_p):
    print(ans - abs(min_p)*2)
  else:
     print(ans - abs(min_m)*2)
else:
  print(ans)


Measured memory_bytes: 14412
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

int main(){
    int n, q; cin>>n>>q;
    vector<T> X(n);
    for(int i=0; i<n; i++){
        int s, t, x; cin>>s>>t>>x;
        X[i] = T(x, s - x, t - x);
    }

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

    set<P> st;
    for(int i=0; i<q; i++){
        int d; cin>>d;
        st.insert(P(d, i));
    }

    vector<int> ans(q, -1);
    for(int i=0; i<n; i++){
        int x, s, t;
        tie(x, s, t) = X[i];
        auto itr = st.lower_bound(P(s, -1));

        while(itr != st.end()){
            if(t <= itr->first) break;

            ans[itr->second] = x;
            st.erase(itr++);
        }
    }

    for(int i=0; i<q; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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; }

using namespace std;
typedef pair<ll, ll> pint;


void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }

}

int main() {

    int N;
    cin >> N;
    ll ans = 0;
    REP(i,1, N+1){
        if (i % 3 != 0 && i % 5 != 0) {
            ans += i;
        }
    }

    cout << ans << endl;



}

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

using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
const int N = 1e5 + 10;
const double eps = 1e-9;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        while (x % 2 == 0)
            x /= 2, ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int X;
    cin>>X;
    int a[41]={1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,36,216,49,343,100,1000,121,144,169,196,225,289,324,361,400,441,484,529,576,676,784,841,900,961};
    sort(a,a+41);
    for(int i=40;i>=0;i--){
        if(X>=a[i]){
            cout<<a[i]<<endl;
            return 0;
        }
    }
    
}



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

int main()
{
  int n;
  cin >> n;
  map<ll, int> m;
  string ans = "YES";
  rep(i, n)
  {
    ll a;
    cin >> a;
    if (m[a])
    {
      ans = "NO";
      break;
    }
    m[a]++;
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long
const int mod = 1e9 + 7;
ll int INF = 1e17;

ll int dp[1005][1005];

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(dp, -1, sizeof dp);

  int n, m;
  cin>>n>>m;
  char c;

  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
    {
      cin>>c;
      dp[i][j] = (c == '.') ? 0 : -1;
    }

  dp[0][0] += 1;

  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      if(dp[i][j] > 0)
      {
        if(dp[i][j+1] != -1)
          dp[i][j+1] = (dp[i][j+1] + dp[i][j]) % mod;
        if(dp[i+1][j] != -1)
          dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % mod;
      }

  cout<<dp[n-1][m-1]<<endl;

  return 0;
}


Measured memory_bytes: 8192
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int need = a - b;
    if(need>=c){
      System.out.println(0);
    }else{
      System.out.println(c - need);
    }
  }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		scanner.close();

		if (N % 2 == 0) {
			System.out.println(N);
		} else if (N % 2 == 1) {
			System.out.println(N * 2);
		}
	}
}

Measured memory_bytes: 22996
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("-Ofast","-funroll-all-loops","-ffast-math")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <bitset>
#include <cassert>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define endl '\12'
#define eb emplace_back
#define SZ(a) int32_t(a.size())
#define ALL(x) (x).begin(),(x).end()
#define trav(a,x) for (auto& a: x)
#define LOG(FMT...) fprintf(stderr, FMT)
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define CASET int ___T; cin>>___T; for(int __CS=1;__CS<=___T;__CS++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
constexpr int mod = 1e9+7;
constexpr int Erica = 998244353;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count()); 
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll ex_gcd(ll a, ll b, ll& x, ll& y){if(!b){x=1;y=0;return a;}ll ret=ex_gcd(b,a%b,y,x);y-=a/b*x;return ret;}
LL bin(LL x, LL n, LL MOD) {LL ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
int norm(int x) { return x >= mod ? (x - mod) : x; }
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
inline ll get_inv(ll a) { ll x, y; ex_gcd(a, mod, x, y); return norm(x + mod);}
template<class T>inline void umin(T &x, T y) {x = x > y ? y : x;}
template<class T>inline void umax(T &x, T y) {x = x < y ? y : x;}
template<class T>inline void dec(T &x, T y) {x -= y; if(x < 0) x += mod;}
template<class T>inline void add(T &x, T y) {x += y; if(x >= mod) x -= mod;}
const double PI = acos(-1.0);
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr ull base=2333, P_1=19260817, P_2=999998639;
constexpr int maxn = 1e6+10; // remember to calculate. if tle, check maxn first.
string s;
int main()
{
    close;
    cin >> s;
    ll ans = 0;
    for(auto c : s){
        ans+=(c-'0');
    }
    cout << (ans % 9 == 0 ? "Yes":"No") <<endl;
    return 0;
}

Measured memory_bytes: 3756
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(std::vector<long long> A){
    if(A[0]+A[1]+A[2]>=22)cout<<"bust"<<endl;
    else cout<<"win"<<endl;

}

int main(){
    std::vector<long long> A(3);
    for(int i = 0 ; i < 3 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(std::move(A));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	string s;
	cin >> s;
	int x = 0;
	for (int i = 0; i < 4; i++)
	{
		if (s[i] == '+') x++;
		else x--;
	}
	cout << x;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
sum_A = sum(A)
B = list(map(int,input().split()))


for i in range(N):
	#Bが大きい場合
	if B[i]-A[i] >= 0:
		B[i] = B[i]-A[i]
		A[i] = 0
		if B[i]-A[i+1]>=0:
			A[i+1] = 0
			B[i] -=A[i+1]
		else:
			A[i+1] -= B[i]
	#Aが大きい場合
	else:
		A[i] -= B[i]


print(sum_A - sum(A))


Measured memory_bytes: 18476
n, m = map(int, input().split())
correct = {i: 0 for i in range(1,n+1)}
acs = 0
penal = {i: 0 for i in range(1,n+1)}

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        if not correct[p]:
            acs += 1
            correct[p] = 1
    else:
        if not correct[p]:
            penal[p] += 1

wa = 0
for key in penal.keys():
    if correct[key]:
        wa += penal[key]
print(acs, wa)

Measured memory_bytes: 27368
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>

#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,n) for(int i=0;i<(n); i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)

using namespace std;
typedef long long ll;
const int NMAX = 100;
const int k = 200000;
static const int INF = 1<<29;
string s,t,ans;
int dp[3001][3001];
ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b, a%b);
}
int M[NMAX+1][NMAX+1]={0};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる
    // 追加２, 以降 cin の入力元が 'input.txt' になる

    int n;
    cin >> n;
    rep2(i,n){
        int u,k;
        cin >> u >> k;
        int v[k+1];
        rep2(j,k) cin >> v[j];
        rep2(j,k){
            M[i][v[j]]=1;
        }
    }
    rep2(i,n){
        rep2(j,n-1){
            cout << M[i][j] << " ";
        }
        cout << M[i][n] << endl;
    }
    return 0;
}


Measured memory_bytes: 3248
#include <iostream>
using namespace std;
//どんどん大きく or 平坦にしなければならない.
int main(){
    int N,i=0;
    int work;
    cin >> N;
    int H[N];
    bool flag = false;
    for(int i =0;i<N;i++){
        cin >> H[i];
    }
    int max = -1;
    for(int i = 0;i<N-1;i++){
        if(max <= H[i]){
            max = H[i];
        }
        if(2 <= max - H[i+1] ){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
auto rd=read<int>;
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;

const int N=501;
int n, a[N][N];
s64 s[N][N], ds[N][N], f[N][N];
int main() {
	n=rd();
	for(int i=1; i<=n; ++i) {
		for(int j=1; j<=n; ++j) if(i!=j) a[i][j]=rd();
		for(int j=1; j<=n; ++j) s[i][j]=s[i][j-1]+a[i][j];
		for(int j=1; j<=n; ++j) s[i][j]+=s[i-1][j];
		for(int j=i; j<=n; ++j) ds[i][j]=ds[i][j-1]+a[i][j];
		for(int j=1; j<=n; ++j) ds[i][j]+=ds[i-1][j];
	}
	for(int i=0; i<=n; ++i) memset(f[i], 63, (n+1)*sizeof(s64));
	f[0][0]=0;
	for(int i=0; i<=n; ++i)
		for(int j=i; j<=n; ++j)
			if(f[i][j]<1e18)
				for(int k=j+1; k<=n; ++k)
					cmin(f[j][k], f[i][j]+ds[k][k]-ds[j][k]-ds[k][j]+ds[j][j]+s[k][i]-s[j][i]);
	s64 ans=1e18;
	for(int i=1; i<n; ++i) cmin(ans, f[i][n]);
	printf("%llu\n", ans);
	return 0;
}


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

using namespace std;
using ll = long long;

#define REP(i,m,n) for(int (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,0,N) cin >> A[i];

    vector<ll> I(N);
    REP(i,0,N) I[i] = i+1;

    sort(ALL(I), [&A](ll i1, ll i2){return A[i1-1] < A[i2-1];});

    REP(i,0,N) _PS(I[i]);

    return 0;
}

/*



*/

Measured memory_bytes: 2432
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = a[0]
cnt = 1
num = 0
for _ in range(n - 2):
    ans += a[cnt]
    if num == 0:
        num += 1
    else:
        num = 0
        cnt += 1
print(ans)


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

int main()
{
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  
  int cnt = 0;
  for(int i = 0; i <= A; ++i)
  {
    for(int j = 0; j <= B; ++j)
    {
      for(int k = 0; k <= C; ++k)
      {
        if(500 * i + 100 * j + 50 * k == X)
        {
          ++cnt;
        }
      }
    }
  }
  
  cout << cnt << endl;
  return 0;
}    

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pans cout<<ans<<endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int main(){
  	string s;cin>>s;
    bool flag=false;
  	for(int i=0;i<3;i++){
      if(s[i]==s[i+1]){
        flag=true;
      }
    }
  int a=0;
  	for(int i=0;i<1500000000;i++){
      a+=1;
    }
  	if(flag){
      cout<<"Bad"<<endl;
    }else{
      cout<<"Good"<<endl;
    }
  
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

ll pow5(ll x) {
    ll xx = x * x;
    return xx * xx * x;
}

int main() {
    ll x;
    cin >> x;
    vector<ll> facts;
    for (ll i=1; i*i <= x; i++) {
        if (x % i) continue;
        facts.push_back(i);
        if (i * i != x) facts.push_back(x / i);
    }
    for (auto &fi:facts) {
        if (fi > 1000) continue;
        for (ll a = 0; true; a++) {
            ll b = a - fi;
            ll d = pow5(a) - pow5(b);
            if (d == x) {
                cout << a << ' ' << b << '\n';
                return 0;
            } else if (b > 0 && d > x) {
                break;
            }
        }
    }
    return 0;
}

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

int main()
{
	int n;
	cin>>n;
	if(n==100000)
		cout<<"90909";
	else
	{
		if(n>=10000&&n<=99999)
			cout<<909+n-9999;
		else
		{
			if(n>=1000&&n<=9999)
				cout<<"909";
			else
			{
				if(n>=100&&n<=999)
					cout<<9+n-99;
				else
				{
					if(n>=10&&n<=99)
						cout<<"9";
					else
						cout<<n;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N; cin >> N;
    vei a(N);
    rep(i,N) cin >> a[i];
    sort(a.rbegin(),a.rend());
    int alice = 0;
    int bob = 0;
    rep(i,N){
        if(i % 2 == 0) alice += a[i];
        else bob += a[i];
    }
    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repd(a,b,c) for(int a=c;a>=b;a--)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pb push_back
#define pbb pop_back
const int N = 5e5+100;
const int mod=1e9+7;
const int inf=1e18;
int power(int a,int b)
{
  int ans=1;
  while(b)
  {
    if(b&1)ans*=a;
    a*=a;
    b/=2;
  }
  return ans;
}
struct node
{
  int p,z,n;
};
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T=1;
    //cin>>T;
   
    while(T--)
    {
      
                int a,b;
                cin>>a>>b;
                if(a<=0&&b>=0)
                {
                  cout<<"Zero\n";
                }
                else
                {
                  if(a>0)
                  {
                    cout<<"Positive\n";
                  }
                  else
                  {
                    a=a-b;
                    a=abs(a)+1;
                    if(abs(a)&1)
                    {
                      cout<<"Negative\n";
                    }
                    else
                    cout<<"Positive\n";
                  }
                }

     

        
        
      
      
      
    }

    
    
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<map>
#include<functional>
using namespace std;

const int mod = 1e9+7;
const int INFINT = INT_MAX/2;
typedef long long ll;
typedef unsigned long long ull;

struct Edge{
    int dst;
    int weight;
    Edge(int dst, int weight): dst(dst), weight(weight) {}
};

struct TmpDist{
    int vertex;
    int dist;
    TmpDist(int vertex, int dist): vertex(vertex), dist(dist) {}
    bool operator< (const TmpDist& right)const{
        return dist > right.dist;
    }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

vector<int> dijkstra(Graph &G, int r){
    int V = G.size();
    vector<int> dist(V, INFINT);
    priority_queue<TmpDist> pq;
    vector<bool> check(V, false);
    TmpDist init(r, 0);
    pq.push(init);
    while(!pq.empty()){
        TmpDist td = pq.top();pq.pop();
        int now = td.vertex;
        if(!check[now]){
            check[now] = true;
            dist[now] = td.dist;
            for (int i=0;i<G[now].size();i++){
                if(dist[G[now][i].dst] > td.dist + G[now][i].weight){
                    TmpDist tdCandidate(G[now][i].dst, td.dist + G[now][i].weight);
                    pq.push(tdCandidate);
                }
            }
        }
    }
    return dist;
}

int main(){
    int V, E, r;
    cin >> V >> E >> r;
    Graph G(V);
    int s, t, w;
    for(int i=0;i<E;i++){
        cin >> s >> t >> w;
        Edge e(t, w);
        G[s].push_back(e);
    }

    vector<int> dist = dijkstra(G, r);
    for (int i=0;i<V;i++){
        if(dist[i] == INFINT) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 14088
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

// セグメント木
// ref:https://ei1333.github.io/luzhiled/snippets/structure/segment-tree.html
template <typename Mnd>
struct segment_tree {
    int sz;
    vector<Mnd> data;
    function<Mnd(Mnd, Mnd)> f;
    Mnd e;
    //サイズだけ指定して初期化
    segment_tree(int _sz, function<Mnd(Mnd, Mnd)> _f, Mnd _e) : f(_f), e(_e) {
        sz = 1;
        while (sz < _sz) sz <<= 1;
        data.assign(sz * 2, e);
    }
    //参照渡しなので代入とかもできる
    Mnd& operator[](const int& k) {
        return data[k + sz];
    }
    //木を構築 O(n)
    void build() {
        for (int i = sz - 1; i > 0; i--) data[i] = f(data[2 * i], data[2 * i + 1]);
    }
    //更新しつつ木を再構築 O(log n)
    void update(int k, Mnd x) {
        data[k += sz] = x;
        while (k >>= 1) data[k] = f(data[2 * k], data[2 * k + 1]);
    }
    //[a,b)でのクエリに答える　O(log n)
    Mnd query(int a, int b) const {
        Mnd l = e, r = e;
        for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if (a & 1) l = f(l, data[a++]);
            if (b & 1) r = f(r, data[--b]);
        }
        return f(l, r);
    }
};

int M = 400000;
int n, k;
vector<int> a;

int main() {
    cin >> n >> k;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    auto m = [](int a, int b) { return max(a, b); };
    segment_tree<int> seg(M, m, 0);
    for (int i = 0; i < n; i++) {
        int cand = seg.query(max(0, a[i] - k), min(M, a[i] + k + 1));
        seg.update(a[i], cand + 1);
    }
    cout << seg.query(0, M) << endl;
}

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

int main(){
    //freopen("in.txt", "r", stdin);
    int a;
    cin>>a;
    int mini = a, sum = 0; 
    for (int i=1;i<5;++i){
        cin>>a;
        int rem = a%10;
        if (rem == 0) sum += a;
        else if (rem < mini%10) {
            sum += 10*(mini/10) + 10;
            mini = a;
        }
        else sum += 10*(a/10) + 10;
    }
    sum += mini;
    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
  vector<vector<int>> a(3, vector<int>(3));
  vector<vector<bool>> c(3, vector<bool>(3, false));
  cin >> a.at(0).at(0) >> a.at(0).at(1) >> a.at(0).at(2);
  cin >> a.at(1).at(0) >> a.at(1).at(1) >> a.at(1).at(2);
  cin >> a.at(2).at(0) >> a.at(2).at(1) >> a.at(2).at(2);
  int n; 
  cin >> n;
  for (int i = 0; i < n; ++i)  {
    int b;
    cin >> b;
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        if (a.at(i).at(j) == b) {
          c.at(i).at(j) = true;
        }
      }
    }
  }

  bool judge = false;
  for (int i = 0; i < 3; ++i) {
    if (c.at(i).at(0) && c.at(i).at(1) && c.at(i).at(2)) {
      judge = true;
      break;
    }
    if (c.at(0).at(i) && c.at(1).at(i) && c.at(2).at(i)) {
      judge = true;
      break;
    }
  }
  if (c.at(0).at(0) && c.at(1).at(1) && c.at(2).at(2)) {
    judge = true;
  }
  if (c.at(0).at(2) && c.at(1).at(1) && c.at(2).at(0)) {
    judge = true;
  }
  if (judge) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 3576
#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, K;
  cin >> A >> B >> C >> K;

  int cnt = 0;
  while (A >= B) {
    cnt++;
    B *= 2;
  }
  while (B >= C) {
    cnt++;
    C *= 2;
  }
  if (cnt <= K)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		int left = 1;
		int right = N;

		for (int i = 0; i < M; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			left = Math.max(left, a);
			right = Math.min(right, b);
		}
		int answer = right - left + 1;
		if (answer > 0) {
			System.out.println(answer);
		} else {
			System.out.println(0);
		}

	}

}

Measured memory_bytes: 58412
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    A = 'Vacant'
    N = int(input())

    print(0)
    S = input()
    if S == A:
        return

    r = N
    l = 0
    while l < r - 1:
        m = (r + l) // 2
        print(m)
        s = input()
        if s == A:
            return

        if (m - l) % 2 == 0 and S == s:
            l = m
            S = s
        elif (m - l) % 2 == 1 and S != s:
            l = m
            S = s
        else:
            r = m
    print(l)
    input()


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


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

int main() {
  ios::sync_with_stdio(false);

  int N, K;
  cin >> N >> K;

  int ans = 0;

  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    if (h >= K) ans++;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j, c, k=VMAX;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(c=1;c<=n;c++){
    scanf("%hu",&A[c]);
    //C[A[c]]++;
  }

  
  for(i=0;i<=k;i++){
    C[i]=0;
  }
  
  for(j=1;j<=n;j++){
    C[A[j]]++;
  }
  
  for(i=1;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }
  
  for(j=n;j>=1;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
    }

  for(c=1;c<n;c++){
    printf("%hu ",B[c]);
  }
  printf("%hu\n",B[n]);

  return 0;
}



Measured memory_bytes: 9652
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>

int main()
{
    ll n,ans=0;
    cin>>n;vl l(n);rep(i,n)cin>>l[i];sort(l.begin(),l.end());
    rep(i,n)rep(j,i)ans += (lower_bound(l.begin(), l.end(), l[i]+l[j]) - l.begin()) - i - 1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
 
String a = sc.next();
String b = sc.next();
String c = sc.next();

a = a.toUpperCase();
b = b.toUpperCase();
c = c.toUpperCase();

System.out.print(a.charAt(0));
System.out.print(b.charAt(0));
System.out.print(c.charAt(0));

}
}

 


Measured memory_bytes: 21844
from math import floor, ceil
[A, B] = list(map(int, input().split()))

def main(A, B):
    
    underN = min(int(A // 0.08), int(B // 0.1))
    upperN = max(int(ceil(A / 0.08)), int(ceil(B / 0.1)))

    for i in range(underN, upperN+1):

        if int(floor(i*0.08)) == A and int(floor(i*0.1)) == B:
            return i
    
    else: return -1
    

if __name__ == "__main__":

    answer = main(A, B)
    print(answer)
    


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;

ll countPairs(vector<ll>& a, int n, ll k) {
    ll count = 0;
    ll sum = 0;
    for (int l = 0, r = 0; r < n; r++) {
        sum += a[r];
        while (l < r && sum > k) {
            sum = sum - a[l];
            l++;
        }
        if (sum <= k) {
            count += r - l + 1;
        }
    }
    return count;
}

int main() {
    int n, q;
    cin >> n >> q;
    vector<ll> a (n);
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i < q; i++) {
        ll k;
        cin >> k;
        cout << countPairs(a, n, k) << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

void solve()
{
	ll n;
	cin>>n;
	vector<ll> v(n);
	for(auto &i:v) cin>>i;

	ll ans=1;
ll prev=INT_MAX,count=0;
for(int i=0;i<n;i++)
{
	if(v[i]<=prev)
		count++;
	else
		ans=max(ans,count),count=1;
	prev=v[i];
}
cout<<max(ans,count)-1;

}
int main()
{


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


	return 0;
}


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

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


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

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int yakuCount = inpt[0];
        this.GoalA = inpt[1];
        this.GoalB = inpt[2];

        for (int i = 0; i < yakuCount; i++)
        {
            this.YakuList.Add(new Yakuhin(Reader.ReadLine()));
        }
        int ans = GetAns(0, 0, 0);
        Console.WriteLine(ans);
    }
    private Dictionary<int, Dictionary<int, Dictionary<int, int>>> dic = new Dictionary<int, Dictionary<int, Dictionary<int, int>>>();
    private int GetAns(int idx, int totalA, int totalB)
    {

        if (totalA % GoalA == 0 && totalB % GoalB == 0)
        {
            if (totalA > 0 && totalB > 0 && totalA / GoalA == totalB / GoalB)
            {
                return 0;
            }
        }
        if (idx >= this.YakuList.Count)
        {
            return -1;
        }

        if (!dic.ContainsKey(idx))
        {
            dic.Add(idx, new Dictionary<int, Dictionary<int, int>>());
        }
        if (!dic[idx].ContainsKey(totalA))
        {
            dic[idx].Add(totalA, new Dictionary<int, int>());
        }

        if (dic[idx][totalA].ContainsKey(totalB))
        {
            return dic[idx][totalA][totalB];
        }
        int ans = int.MaxValue;

        int ret = this.GetAns(idx + 1, totalA, totalB);
        if (ret >= 0)
        {
            ans = ret;
        }
        ret = this.GetAns(idx + 1, totalA + this.YakuList[idx].A, totalB + this.YakuList[idx].B);
        if (ret >= 0)
        {
            ans = Math.Min(ans, ret + this.YakuList[idx].Cost);
        }
        if (ans == int.MaxValue)
        {
            ans = -1;
        }
        dic[idx][totalA][totalB] = ans;
        return ans;
    }


    private int GoalA;
    private int GoalB;
    private List<Yakuhin> YakuList = new List<Yakuhin>();

    public class Yakuhin
    {
        public int A;
        public int B;
        public int Cost;

        public Yakuhin(string inpt)
        {
            int[] tmp = inpt.Split(' ').Select(a => int.Parse(a)).ToArray();
            this.A = tmp[0];
            this.B = tmp[1];
            this.Cost = tmp[2];
        }
    }

    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"



1 1 10
10 10 10



";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 31696
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int ans = 0;
		int num = 0;
		while(N/(int)Math.pow(10, num) > 0) {
			num++;
		}

		for(int i = 0;i < num-1;i+=2) {
			ans += 9 * Math.pow(10,i);
		}
		if(num%2 == 1) {
			ans += N - Math.pow(10, num-1) + 1;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 21844