akhauriyash/Code-Regression huggingface dataset:
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> hs(n); cin >> hs;
    bool ok = true;
    for(int i = 1; i < n; i++){
        if(hs[i] > hs[i - 1]){
            hs[i]--;
        }
        ok &= hs[i] >= hs[i - 1];
    }
    cout << (ok ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  int Q;
  cin >> Q;

  bool flag = true;
  string t = "", u = "";
  while(Q--){
    int q;
    cin >> q;
    if(q == 1) flag = !flag;
    else{
      int f;
      string c;
      cin >> f >> c;
      if((flag && f == 1) || (!flag && f == 2)){
        t += c;
      }else{
        u += c;
      }
    }
  }

  reverse(ALL(t));
  s = t+s+u;
  if(!flag){
    reverse(ALL(s));
  }

  cout << s << "\n";

  return 0;
}

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

int main(){
    long long x,ans = 0LL;
    cin >> x;
    long long tmp = x/11LL, tmp2 = x%11LL;
    ans = 2LL * tmp;
    if(0LL < tmp2 && tmp2 <= 6) ans++;
    else if(tmp2 > 6) ans += 2LL;
    cout << ans << endl;
}

Measured memory_bytes: 3548
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
MOD = 10**9+7

H,W = imn()
aw = [input() for _ in range(H)]

dp = [[0 for _ in range(W+1)] for _ in range(H+1)]

dp[0][0] = 1

for i in range(H):
    for j in range(W):
        if i+1 < H and aw[i+1][j] == '.': dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % MOD 
        if j+1 < W and aw[i][j+1] == '.': dp[i][j+1] = (dp[i][j+1] + dp[i][j]) % MOD
print(dp[H-1][W-1])

Measured memory_bytes: 81240
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, p;
	cin >> n >> p;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	vector<vector<ll>> dp(n+1, vector<ll>(5505, 0));
	dp[0][0] = 1;
	rep(i,n){
		rep(j,5001){
			dp[i+1][j] += dp[i][j];
			dp[i+1][j+a[i]] += dp[i][j];
		}
	}
	ll ans = 0;
	rep(j,5001){
		if(j%2 == p) ans += dp[n][j];
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i=(a);i>=(b);i--)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    int n;
    cin >> n;
    vector<int> A;
    A.pb(n);

    while(n){
        if(n%2==0){
            n=n/2;
        }else{
            n=3*n+1;
        }
        if(find(A.begin(),A.end(),n)!=A.end()){
            cout << A.sz()+1 << endl;
            return 0;
        }else{
            A.pb(n);
        }
    }

    return 0;
}


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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pinin=pair<int ,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rell(i,n) for (ll i=0; i< (ll)(n); i++)
#define sort(x) sort(x.begin(), x.end());
#define rese(x) reverse(x.begin(), x.end());

string yes="Yes",no="No";

int main() {
   ll n,k;
   cin>>n>>k;
   ll t=1;
   rep(i,10000){
       if(n<t){
           cout<<i<<endl;
           return 0;
       }
       else t*=k;
   }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;
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; }

int main(void){
  ll n, k;
  cin >> n >> k;
  n = k + n%k;
  cout << min(abs(n-k), (k-n%k)) << endl;
}


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

string s;
int c[130];

int main() {
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		c[(int)s[i]]++;
	}
	bool f = true;
	for (int i = 97; i < 123; i++) {
		if (c[i] > 1)f = false;
	}
	if (f)cout << "yes";
	else cout << "no";
	cout << endl;
	return 0;
}

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

using namespace std;

int main(void) {
  int n, m;
  while (cin >> n >> m, n) {
    vector<int> va(1, 0);
    for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      if (a > m) continue;
      va.push_back(a);
    }
    sort(va.begin(), va.end());

    int az = va.size();
    vector<int> vb;
    for (int i = 0; i < az; i++) {
      for (int j = i; j < az; j++) {
        if (va[i] + va[j] > m) break;
        vb.push_back(va[i] + va[j]);
      }
    }
    sort(vb.begin(), vb.end());

    int bz = vb.size(), l = 0, r = 0;
    vector<int> vc;
    while (l < bz) {
      vc.push_back(vb[l]);
      while (r < bz && vb[r] == vb[l]) r++;
      if (vb[r] == vb[l]) break;
      l = r;
    }

    int cz = vc.size(), ans = 0;
    for (int i = 0; i < cz; i++) {
      int p = lower_bound(vc.begin(), vc.end(), m - vc[i]) - vc.begin();
      if (vc[i] + vc[p] <= m) {
        ans = max(ans, vc[i] + vc[p]);
      } else {
        ans = max(ans, vc[i] + vc[p - 1]);
      }
    }

    cout << ans << endl;
  }

  return 0;
}


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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> price(N);
  for(int i = 0; i < N; i++){
    cin >> price.at(i);
  }
  sort(price.begin(), price.end());
  int sum = 0;
  for(int i = 0; i < K; i++){
    sum += price.at(i);
  }
  cout << sum << endl;
}

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

int main(){

	int n;
	cin >> n;
	int t = 0;
	int h = 0;
	for (int i = 0; i < n; i++){
		string a, b;
		cin >> a>> b;
		if (a == b){
			t++;
			h++;

		}
		else if(a>b){
			t += 3;
		}
		else if (a < b){
			h += 3;
		}
	}
	cout << t << ' ' << h << endl;
	return 0;

}


Measured memory_bytes: 3192
import java.util.Scanner;

/**
 * Algae
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int r = sc.nextInt();
            int D = sc.nextInt();
            int x = sc.nextInt();

            for (int i = 0; i < 10; i++) {
                x = r * x - D;
                System.out.println(x);
            }
        }
    }

}


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

typedef long long int ll;

vector<ll> a;

const int N = 3333;

ll dp[2][N][N];

ll f(int k, int i, int j)
{
  if(~dp[k][i][j]) return dp[k][i][j];
  
  ll& ans = dp[k][i][j];
  
  if(i == j)
  {
    if(k == 0) return ans = a[i];
    else return ans = 0;
  }
  
  if(k == 0)
    ans = max(a[i] + f(1, i+1, j), a[j] + f(1, i, j-1));
  else ans = min(f(0, i+1, j), f(0, i, j-1));
  
  return ans;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  
  int n;
  cin >> n;
  a = vector<ll>(n);
  for(ll& i: a ) cin >> i;
  
  ll sum = 0; for(ll i: a) sum += i;
  memset(dp, -1, sizeof dp);
  cout << 2 * f(0, 0, n-1) - sum << endl;
  
  return 0;
}


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

int A[4];

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

    int a, b;
    cin >> a >> b;

    A[a] = A[b] = 1;

    for(int i=1; i<=3; i++)
        if(A[i] == 0)
            cout << i << "\n";

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	//sc.Split(bufio.ScanWords)
	buf := make([]byte, 10000)
	sc.Buffer(buf, 200010)
	sc.Scan()
	t := sc.Text()
	//a := strings.Split(t, "")

	//if a[len(a)-1] == "?" { a[len(a)-1] = "D"}
	//if len(a) < 2 {
	//	fmt.Println(strings.Join(a, ""))
	//	return
	//}

	//for i := len(a)-2; i >= 0; i-- {
	//	if a[i] != "?" { continue }
	//	if a[i-1] == "D" {
	//		a[i] = "P"
	//	} else {
	//		a[i] = "D"
	//	}
	//}

	fmt.Println(strings.ReplaceAll(t, "?", "D"))
}

func slicePrint(s []int) {
	for i, v := range s {
		if i != 0 {
			fmt.Printf(" ")
		}
		fmt.Printf("%v", v)
	}
	fmt.Println("")
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 3092
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long C = sc.nextLong();
		long[][] arraytmp = new long[N][2];
		long[][] arraytmp2 = new long[N][2];
		long[][] array = new long[N + 2][2];
		long[][] array2 = new long[N + 2][2];
		for (int i = 0; i < N; i++) {
			arraytmp[i][0] = sc.nextLong();
			arraytmp[i][1] = sc.nextLong();
		}
		System.arraycopy(arraytmp, 0, arraytmp2, 0, N);
		Arrays.sort(arraytmp, (a, b) -> Long.compare(a[0], b[0]));
		Arrays.sort(arraytmp2, (b, a) -> Long.compare(a[0], b[0]));
		System.arraycopy(arraytmp, 0, array, 1, N);
		System.arraycopy(arraytmp2, 0, array2, 1, N);
		array[0][0] = 0;
		array[0][1] = 0;
		array[N + 1][0] = C;
		array[N + 1][1] = 0;
		array2[0][0] = C;
		array2[0][1] = 0;
		array2[N + 1][0] = 0;
		array2[N + 1][1] = 0;

		long ans = 0;

		long[] memo = new long[N + 2];
		long go = 0;
		long stop = 0;
		for (int i = 1; i < N + 1; i++) {
			if (array[i][1] - array[i][0] >= 0) {
				go += array[i][1] - array[i][0] + array[i - 1][0];
			} else {
				stop = Math.max(stop, go);
				go += array[i][1] - array[i][0] + array[i - 1][0];
			}
			memo[i + 1] = Math.max(go, stop);
		}
		long[] memo2 = new long[N + 2];
		long go2 = 0;
		long stop2 = 0;
		for (int i = 1; i < N + 1; i++) {
			if (array2[i][1] - (C - array2[i][0]) >= 0) {
				go2 += array2[i][1] - (C - array2[i][0]) + (C - array2[i - 1][0]);
			} else {
				stop2 = Math.max(stop2, go2);
				go2 += array2[i][1] - (C - array2[i][0]) + (C - array2[i - 1][0]);
			}
			memo2[i + 1] = Math.max(go2, stop2);
		}
		long first = 0;
		long total = 0;
		for (int k = 0; k < N + 2; k++) {
			if (k != 0) {
				first += array2[k][1] - 2 * (C - array2[k][0] - (C - array2[k - 1][0]));
			}
			long tmp = memo[N + 1 - k];
			total = Math.max(total, first + tmp);
		}
		long first2 = 0;
		long total2 = 0;
		for (int k = 0; k < N + 2; k++) {
			if (k != 0) {
				first2 += array[k][1] - 2 * (array[k][0] - (array[k - 1][0]));
			}
			long tmp = memo2[N + 1 - k];
			total2 = Math.max(total2, first2 + tmp);
		}
		ans = Math.max(total, total2);

		System.out.println(ans);
	}
}


Measured memory_bytes: 105744
/*
https://atcoder.jp/contests/dp/tasks/dp_c
*/
#include<bits/stdc++.h>
using namespace std;

int main(){

    int n;  cin>>n;

    int cost[n][3];
    int dp[n][3];   /// here dp[i][j] represents max cost on ith day if i do jth acitivity

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

    dp[0][0] = cost[0][0];
    dp[0][1] = cost[0][1];
    dp[0][2] = cost[0][2];

    for(int i=1;i<n;i++){

        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + cost[i][0];

        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + cost[i][1];

        dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + cost[i][2];

    }

    int ans = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

    cout<<ans<<"\n";

return 0;
}



Measured memory_bytes: 2560
package main

import "fmt"

func main() {
	var a[3] int
	fmt.Scan(&a[0],&a[1],&a[2])
	if((a[0] == a[1] && a[1] != a[2]) || (a[0] == a[2] && a[1] != a[2]) || (a[2] == a[1] && a[0] != a[2])) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
import queue
k = int(input())
q = queue.Queue()
cnt = 0
for i in range(1,10):
    q.put(i)
while True:
    a = q.get()
    cnt += 1
    if cnt == k:
        print(a)
        break
    else:
        s = a%10
        if s != 0:
            q.put(10*a + s-1)
        q.put(10*a + s)
        if s != 9:
            q.put(10*a + s+1)

Measured memory_bytes: 57172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T> T in(){T x;cin>>x;return x;}
// long long a = in<long long>();
template<class T> vector<T> inarr(int s,int e, T init){
	vector<T> v;T x;
	for(int i=0;i<s;++i)v.push_back(init);
	for(int i=s;i<e;++i){cin>>x;v.push_back(x);}
	return v;
}
// vi P = inarr<int>(0,N,0);
// vi P = inarr<int>(1,N+1,INT_MAX);
// vs P = inarr<string>(0,N,"");
template<class T>void outarr(int s,int e,vector<T> &V){
	for(int i=s;i<e;i++)cout<<V[i]<<(i<e-1?" ":"\n");
}
// outarr<int>(0,V.size(),V);
// outarr<ll>(0,V.size(),V);

// #define MAX 1'000'000'000
string S;
int Q;
vi V;
int cnt=0;
int st;
int ed;
int len;

void type2(int f, char c){
	if(cnt%2){//odd:reverse
		if(f-1){//f==2
			// S = c+S;
			st--;
			S[st] = c;
		}
		else{//f==1
			// S = S+c;
			S[ed] = c;
			ed++;
		}

	}
	else{//even
		if(f-1){//f==2
			// S = S+c;
			S[ed] = c;
			ed++;
		}
		else{//f==1
			// S = c+S;
			st--;
			S[st] = c;
		}


	}
}


int main(){
	cin>>S>>Q;
	len = S.size();
	string a(Q,'-');
	st = Q;
	ed = st+len;
	S = a+S+a;
	// ote(S);///
	// ote(st);///
	// ote(ed);///

	rp(i,0,Q){
		int t;cin>>t;
		// ote(t);
		if(t-1){//type2
			int f; char c; cin>>f>>c;
			type2(f, c);
		}
		else{//type1
			cnt++;
		}
	}
	// if(cnt%2) reverse(all(S));//odd
	if(cnt%2){//odd:reverse
		irp(i,ed-1,st-1)cout<<S[i];

	}
	else{//even
		rp(i,st,ed)cout<<S[i];
	}
	puts("");
	// cout<<S<<endl;
}


Measured memory_bytes: 1496
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	ans := mod * mod
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			ans = smaller(ans, i+n/i-2)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int c=0,t,p=0,a=0;
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  r(b,12)if(s[b]=='?')r(i,10){
      s[b]='0'+i;
      for(int j=11;j>0;j--){
    if(j>=7)a+=(j-5)*(s[j]-'0');
    else a+=(j+1)*(s[j]-'0');
    //cout<<j<<' '<<j-5<<endl;
      }
      if(a%11<=1)a=0;
      else a=11-a%11;
      if(a==s[0]-'0'){c++;t=i;}
      a=0;
    }
  if(c==1)cout<<t<<endl;//cout<<c;
  else cout<<"MULTIPLE"<<endl;
}

Measured memory_bytes: 3216
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	In := readLineInt()
	Num, _ := strconv.Atoi(fmt.Sprintf("%d%d%d", In[0], In[1], In[2]))
	if Num%4 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

/////////////////////////////////////////

func readLineInt() []int {
	result := make([]int, 0)
	for _, v := range strings.Split(readLine(), " ") {
		i, _ := strconv.Atoi(v)
		result = append(result, i)
	}
	return result
}

var reader = bufio.NewReaderSize(os.Stdin, 1e6)

func readLine() string {
	result := make([]byte, 0, 1e6)
	for {
		line, remains, e := reader.ReadLine()
		if e != nil {
			panic(e)
		}
		result = append(result, line...)
		if !remains {
			break
		}
	}
	return string(result)
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
void write(int x){if (x<0)putchar('-'),x=-x;if (x)write(x/10),putchar(x%10+'0');}
void writeln(int x){write(x);if (x==0)putchar('0');puts("");}
bitset<4000010> f;
int a[4000010],n,d,x;
signed main(){
	n=read();f[0]=1;for (int i=1;i<=n;i++){
		x=read();f|=f<<x;
	} for (int i=1;i<=4000000;i++)if (f[i])a[++d]=i;
	cout<<a[(d+1)/2]<<endl;
}



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

int main() {
	int r, g, b, n;
	cin >> r >> g >> b >> n;

	int count=0;

	for(int i=0;i<=n/r;++i){
		for(int j=0;j<=(n-r*i)/g;++j){
			if((n-i*r-j*g)%b==0){
				count += 1;
			}
		}
	}

	cout << count << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
using namespace std;

struct group {
	long long a, b; int i;
	bool operator <(const group &t)const {
		return a * t.b < t.a * b;
	}
}G[200200];
priority_queue<group> Q;

int N, P[200200], C[200200]; bool chk[200200];

int find(int x)
{
	if (C[x] != x) C[x] = find(C[x]);
	return C[x];
}

int main()
{
	scanf("%d", &N);
	for (int i = 2; i <= N; i++) scanf("%d", &P[i]);
	for (int i = 1; i <= N; i++) {
		int x; scanf("%d", &x);
		if (x == 0) G[i] = { 1,0,i };
		else G[i] = { 0,1,i };
		if (i > 1) Q.push(G[i]);
		C[i] = i;
	}

	long long ans = 0;
	while (!Q.empty()) {
		auto u = Q.top(); Q.pop();

		int x = u.i;
		if (chk[x]) continue;
		chk[x] = 1;

		int y = find(P[x]);
		ans += G[y].b * G[x].a;
		G[y].a += G[x].a;
		G[y].b += G[x].b;
		if (y != 1) Q.push(G[y]);
		C[x] = y;
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 14192
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()

#define PI 3.14159265359

using namespace std;
typedef long long unsigned int ll;

int main() {
	int a,b;
	cin >> a >> b;
	if (a >= b) {
		REP(i, a)cout << b;
	}else REP(i, b)cout << a;
}

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

using namespace std;

vector<char> init(){
  vector<char> data;
  for(int c='a'; c<='z'; ++c) data.push_back(c);
  for(int c='A'; c<='Z'; ++c) data.push_back(c);
  return data;
}

char solve(const char& c, int& x, const vector<char>& data){
  for(int i=0; i<data.size(); ++i){
    if(data[i] == c){
      int j = i-x;
      if(j < 0) j += data.size();
      return data[j];
    }
  }
}

int main(){
  int n;
  string s;
  vector<char> s_name = init();
  while(1){
    cin >> n;
    if(!n) break;
    vector<int> data(n, 0);
    for(int i=0; i<n; ++i) cin >> data[i];
    cin >> s;
    for(int i=0, j=0; i<s.size(); ++i){
      cout << solve(s[i], data[j], s_name);
      ++j;
      if(j == data.size()) j=0;
    }
    cout << endl;
  }
  return 0;
}

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

typedef struct node_t {
	int key;
	struct node_t *parent;
	struct node_t *left;
	struct node_t *right;
} node;

node* newNode(int);
void print(node *);
void inorder(node *);
void preorder(node *);
void insert(int, node *);
void free_tree(node *);

int main(void)
{
	int i, m, k;
	char com[10];
	node *tree_root;
	
	tree_root = newNode(0);
	
	scanf("%d",&m);
	for (i=0; i<m; i++) {
		scanf("%s",com);
		if(com[0] == 'p') {
			print(tree_root->left);
		} else {
			scanf("%d",&k);
			if(com[0] == 'i') {
				insert(k, tree_root);
			}
		}
	}
	
	free_tree(tree_root);
	
	return 0;
}

node* newNode(int key)
{
	node *tmp;
	
	tmp = (node *)malloc(sizeof(node));
	if (tmp == NULL) exit(0);
	
	tmp->key = key;
	tmp->parent = NULL;
	tmp->left = NULL;
	tmp->right = NULL;
	
	return tmp;
}

void print(node *root)
{
	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
}

void inorder(node *node)
{
	
	if(node->left != NULL) inorder(node->left);
	printf(" %d",node->key);
	if(node->right != NULL) inorder(node->right);
}

void preorder(node *node)
{
	printf(" %d",node->key);
	if(node->left != NULL) preorder(node->left);
	if(node->right != NULL) preorder(node->right);
}

void insert(int k, node *tree_root)
{
	node *x, *y, *z;
	
	z = newNode(k);
	y = tree_root;
	x = tree_root->left;
	while (x != NULL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	z->parent = y;
	if(y == tree_root || z->key < y->key) {
		y->left = z;
	} else {
		y->right = z;
	}
}

void free_tree(node *root)
{
	if(root->left != NULL) free_tree(root->left);
	if(root->right != NULL) free_tree(root->right);
	free(root);
}

Measured memory_bytes: 24040
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(b%a==0)
	{
	    cout<<a+b;
	}
	else
	{
	    cout<<b-a;
	}
	return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {

	public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	}

	public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	}
}



Measured memory_bytes: 113232
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int arr[50],k,n;
	cin >> n >> k;
	for(int i=0 ; i<n ; i++)
		cin >> arr[i];

	sort(arr , arr+n , greater<int>());

	int sum = 0;
	for(int i=0 ; i<k ; i++)
		sum += arr[i];

	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
	int n,m,maxi=0;
	cin>>n>>m;
	lol(i,m){
		int a;
		cin>>a;
		maxi=max(maxi,a);
	}
	int ans;
	if(n%2==0){
		ans=max(0,(maxi-n/2)*2-1);
	}
	else{
		ans=max(0,(maxi-n/2)*2-2);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
lists = list(map(int, input().split())) #１行の入力をi[0],i[1]というように空白で分けてを取得し、iに値を入れる
a= lists[2]
t  =lists[0]
while(1): 
    a = a - lists[1]
    if a<=0:
        print("Yes")
        break
    t = t - lists[3]
    if t <= 0:
        print('No')
        break

Measured memory_bytes: 9180
#include <iostream>

using namespace std;
#define swap(x,y) {int temp=y;y=x;x=temp;}
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout <<a<<" "<<b<<" "<<c<< endl;
    return 0;
}


Measured memory_bytes: 256
// AOJ 2801: Suntan
// 2017.11.20 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

long long s[100001], t[100001]; int N;
long long a[100001];

char buf[50], *p;
long long getlong()
{
	long long n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int bsch(long long x)
{
	int m, l = 0, r = N+1;

    while (l < r) {
        m = (l + r) >> 1;
        if (t[m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int main()
{
	int i, k;
	long long ans, T, x, y;
	
	fgets(p=buf, 50, stdin), T = getlong();
	fgets(buf, 50, stdin), N = atoi(buf);
	for (i = 1; i <= N; i++) {
		fgets(p=buf, 50, stdin);
		s[i] = getlong(), p++, t[i] = getlong();
		a[i] = a[i-1] + (t[i]-s[i]);
	}
	s[N+1] = t[N+1] = 1LL << 62;

	ans = 0;
	for (k = bsch(T), i = 1; i <= N; i++) {
		x = s[i] + T; while (t[k+1] <= x) k++;
		y = a[k]-a[i-1];
		if (x > s[k+1]) y += x-s[k+1];
		if (y > ans) {
			ans = y;
			if (ans == T) break;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

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

    int count = 0;
    for(int c = 1; c < N-1; ++c) {
        for(int a = 1; a*a <= (N-c); ++a) {
            if (a*a == (N-c)) {
                count += 1;
                break;
            }
            if ((N-c) % a == 0) count += 2;
        }
    }

    

    cout << count+1 << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;

using namespace std;
int ct = 0;
vector<int> a;
int R[5*(int)1e5],L[5*(int)1e5];
void merge(int left,int mid ,int right){
	int n1 = mid - left;
	int n2 = right - mid;
	REP(i,n1)L[i] = a[left+i];
	REP(i,n2)R[i] = a[mid+i];
	L[n1] = R[n2] = INF;
	int i = 0,j = 0;
	for(int k = left;k < right;k++){
		if(L[i] < R[j])	a[k] = L[i++];
		else a[k] = R[j++];
	}
	ct += right - left;
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;
	cin>>n;
	a.resize(n);for(auto& b:a)cin>>b;
	mergeSort(0,n);
	REP(i,n){
		if(i)cout << ' ';
		cout << a[i];
	}
	cout << endl << ct << endl;
  return 0;
}

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

int K;
bool B[1000000];

int main(){
	cin>>K;
	int t=0;
	for(int i=1;;i++){
		t*=10;
		t+=7;
		t%=K;
		if(!t){
			cout<<i<<endl;
			return 0;
		}
		if(B[t]){
			cout<<-1<<endl;
			return 0;
		}
		B[t]=true;
	}
}


Measured memory_bytes: 4548
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        pw.println(sc.nextInt() + sc.nextInt()/2);
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 25464
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 16;
char cn[cm], * ci = cn;
inline int getint() {
	char C = *ci++;
	int A = C - '0';
	while ((C = *ci++) >= '0') A = A * 10 + C - '0';
	return A;
}

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

	fread(cn, 1, cm, stdin);

	int N = getint(), M = getint();
	int n = 1 << N;
	int dp[1 << 12];
	rep(i, n) dp[i] = 1e9;
	dp[0] = 0;

	rep(i, M) {
		int A = getint();
		int b = getint();
		int C = 0;
		rep(j, b) {
			int c = getint();
			C += 1 << (c - 1);
		}
		for (int j = n - 1; j >= 0; j--) {
			int k = j | C;
			dp[k] = min(dp[k], dp[j] + A);
			dp[j] = min(dp[j], dp[j]);
		}
	}

	if (dp[(1 << N) - 1] >= 1e9) printf("-1");
	else printf("%d", dp[(1 << N) - 1]);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

typedef struct {
	size_t l;
	size_t r;
} _val;

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

static char S[100001];
static _val val[100000];
static count[100000];

int main(void) {
	size_t N, Q;

	count[0] = 0;

	scanf("%zu %zu\n%s\n", &N, &Q, S);

	for (size_t i = 1; i < N; i++) {
		if (S[i - 1] == 'A' && S[i] == 'C') {
			count[i] = count[i - 1] + 1;
		}
		else {
			count[i] = count[i - 1];
		}
	}

	for (size_t i = 0; i < Q; i++) {
		size_t l, r;
		scanf("%zu %zu", &r, &l);
		if (i < Q - 1) {
			scanf("\n");
		}

		printf("%zu\n", count[l - 1] - count[r - 1]);
	}

	return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
int main(){
    int count = 0;
    char buf[3];
    int n;
    scanf("%d",&n);
    stack<int> S;
    for(int i=0;i<n;i++){
        scanf("%s",buf);
        if(buf[0]=='A'){
            S.push(1);
        }else {
            if(!S.empty()){
            S.pop();
            }
            else{
                printf("NO\n");
                return 0;
            }
        }
        
    }
    if(!S.empty()){
        printf("NO\n");
    }
    else{
        printf("YES\n");
        
    }
    
    return 0;
}



Measured memory_bytes: 2704
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        char[] s = sc.next().toCharArray();
        List<Integer> l = new ArrayList<>();
        List<Integer> r = new ArrayList<>();
        int count = 0;
        for (int i = 0 ; i < n - 1 ; i++) {
            if (s[i] != s[i + 1]) count++;
        }
        if (k >= (count + 1 )/ 2) {
            System.out.println(n - 1);
            return;
        }

        count -= 2 * k;

        System.out.println(n - (count + 1));

     }

}


Measured memory_bytes: 27220
n = int(input())
h = [int(x) for x in input().split()]

pre = float('INF')
mcnt = 0
cnt = 0
for i in range(n):
    if(pre >= h[i]):
        cnt += 1
    else:
        cnt = 1

    if(mcnt < cnt):
        mcnt = cnt
    pre = h[i]
print(mcnt-1)

Measured memory_bytes: 14252
import java.util.Scanner;

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();
		
// 		if ((a >= 0 && a <= 100) && (b >= 0 && b <= 0) && (c >= 0 && c <= 100)) {
			if (a < b && b < c) {
				System.out.println("Yes");
			} else {
				System.out.println("No");			
			}
// 		} else {
// 				System.err.println("Err!");	
// 			return;
// 		}		
	}
}


Measured memory_bytes: 26260
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    final int N;

    AtCoder(FastScanner sc) {
        N = sc.nextInt();
    }

    void solve(PrintWriter out) {
        int i = N / 111;
        out.println(N % 111 == 0 ? N : (i + 1) * 111);
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
 
int main(){

    int n,m;
    cin >> n >> m;

    int sei = 0, pen = 0;

    vector<bool> ac(n);
    vector<int> wa(n);
    for(int i = 0; i < n; ++i){
        ac[i] = 0;
        wa[i] = 0;
        }

    for(int i = 0; i < m; ++i){
        int p;
        string s;
        cin >> p >> s;
        p -= 1;
        if(ac[p] == 0){
            if(s == "AC"){
                ac[p] = 1;
                ++sei;
                pen += wa[p];
            }else{
                ++wa[p];
            }
        }
    }

    cout << sei << " " << pen << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int r,n,L,R,h,i,x;int main(){while(cin>>r>>n,r){map<int,int> A,B;for(i=0;i<n;i++){cin>>L>>R>>h;for(x=L;x<=R;x++){if(x!=R)A[x]=max(A[x],h);if(x!=L)B[x]=max(B[x],h);}}double res=99;for(i=-r;i<=r-1;i++){res=min(res,min(r-sqrt(r*r-i*i)+A[i],r-sqrt(r*r-(i+1)*(i+1))+B[i+1]));}cout<<res<<"\n";}}

Measured memory_bytes: 1276
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    bit = []
    for i in range(n):
        bit.append(list(range(A[i] - 1, A[i] + 2)))

    res = 0
    for pattern in product([0, 1, 2], repeat=n):
        value = 1
        for idx, i in enumerate(pattern):
            value *= bit[idx][i]

        if value % 2 == 0:
            res += 1

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m, x, ans = INF32; cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n, vector<int> (m));
	for(int i = 0; i < n; i++)
	{
		cin >> c[i];
		for(int j = 0; j < m; j++) cin >> a[i][j];
	}
	for(int i = 1; i < (1<<n); i++)
	{
		int ii = i, jj = 0, cur = 0;
		bool shit = 1;
		vector<int> u(m);
		while(ii)
		{
			if(ii & 1)
			{
				cur += c[jj];
				for(int j = 0; j < m; j++) u[j] += a[jj][j];
			}
			ii /= 2;
			jj++;
		}
		for(int j = 0; j < m; j++) if(u[j] < x)
		{
			shit = 0;
			break;
		}
		if(shit) ans = min(ans, cur);
	}
	cout << (ans == INF32 ? -1 : ans);

	return 0;
}

Measured memory_bytes: 3664
n = int(input())
a,b = map(int,input().split())
P = list(map(int,input().split()))
ask = [0,0,0]
for p in P:
    if p <= a:
        ask[0] += 1
    elif a+1 <= p <= b:
        ask[1] += 1
    else:
        ask[2] += 1
print(min(ask))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
set<int>a;

for(int i=0;i<k;i++){
    int d;
    cin>>d;
    vector<int>aaa(d);
    for(int j=0;j<d;j++){
        int temp;
        cin>>temp;
        a.insert(temp);        
    }
}
cout<<n-a.size()<<endl;
}

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

using namespace std;
typedef long long ll;

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    ll A[5], n;
    scanf("%lld", &n);
    for(int i = 0; i < 5; i++)
        scanf("%lld", &A[i]);
    ll p = *min_element(A, A+5);
    printf("%lld\n", ((n+p-1)/p)+4);
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define nl                 "\n"
#define ll                 long long
#define pb                 push_back
#define pf                 push_front
#define np                 next_permutation
#define pp                 prev_permutation
#define sz(x)              x.size()
#define sqr(x)             ((x)*(x))
#define pi                 acos(-1)
#define setprecision(x)    fixed<<setprecision((int)(x))
#define mem1(x)            memset(x,0,sizeof(x))
#define mem2(x)            memset(x,-1,sizeof(x))
#define all(x)             (x).begin(),(x).end()
#define rev(x)             reverse(all(x))
#define iota(x,a)          iota(all(x),a)
#define sorta(x)           sort(all(x))
#define sortd(x)           sort(all(x),greater<int>())
#define csort(x,c)         sort(all(x),c)
#define rsort(x)           sort(x.rbegin(),x.rend())
#define faster_io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define count_time         cerr<<nl<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<nl;
#define all_ele(x)         for(auto i:(x)){cout<<i<<' ';}cout<<nl;
#define multiple_test      int t; cin>>t; while(t--){solve();}
#define multiple_test2     int t;cin>>t;for(int i=1; i<=t; i++){cout<<"Case #"<<i<<": "<<test()<<nl;}
#define single_test        solve();
using namespace std;
//vector<vector<int>>p(sz,vector<int>(sz,val));
/*
ll test()
{
    return value;
}
*/
void solve()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    bool ok=false,ok1=false;
    while(b<=a && k!=0)
    {
        b=b*2;
        k--;
    }
    if(b>a)
        ok=true;
    while(c<=b && k!=0)
    {
        c=c*2;
        k--;
    }
    if(c>b)
        ok1=true;
    if(ok && ok1)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
int main()
{
    faster_io //multiple_test2
    //multiple_test
    single_test
    //count_time
    return 0;
}




Measured memory_bytes: 3644
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Integer> map = new HashMap<>();
        map.put("AC", 0);
        map.put("WA", 0);
        map.put("TLE", 0);
        map.put("RE", 0);
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            map.put(str, map.get(str)+1);
        }
        System.out.println("AC x " + map.get("AC")); 
        System.out.println("WA x " + map.get("WA")); 
        System.out.println("TLE x " + map.get("TLE")); 
        System.out.println("RE x " + map.get("RE")); 
    }
}

Measured memory_bytes: 58412