akhauriyash/Code-Regression huggingface dataset:
#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型のペアを持てる定義

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> p(m);
  rep(i,m) cin >> p[i].first >> p[i].second;

  //候補の数を全て調べる(0～999までの範囲)
  rep(x,1000) {
    int keta = 1;
    
    //10で割って１の位から順に値を取得する
    int nx = x/10;
    vector<int> d(1,x%10);
    while (nx) {
      keta++;
      d.push_back(nx%10);
      nx /= 10;
    }
    if (keta != n) continue;
    bool ok = true;
    reverse(d.begin(), d.end());//取得した値を反転させる

    rep(i,m) {
      if (d[p[i].first-1] != p[i].second) ok = false;
    }

    if (ok) {
      cout << x << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1 + 4e3;
typedef long long LL;
typedef pair < int, int > II;
typedef pair < int, II > III;

int n, m;

int main()
{
    #define TASK "ABC"
  //  freopen(TASK".inp","r",stdin);
  //  freopen(TASK".out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m;
    vector < long long > dp(1000 * n + 1 , 1e12);
    int maxval = 1000 * n + 1;
    dp[0] = 0;
    for (int i = 0; i < n; i++){
        long long weight, val;
        cin >> weight >> val;
        for (int j = maxval - val; j >= 0; j--){
            dp[j + val] = min (dp[j + val] , dp[j] + weight);
        }
    }
    for (int i = 1000 * n; i >= 0; i--){
        if (dp[i] <= m){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}




Measured memory_bytes: 1024
N = int(input())

txy = [[0, 0, 0]]
for i in range(N):
    tmp = list(map(int, input().split()))
    txy.append(tmp)
    
for i in range(len(txy)-1):
    start = txy[i]
    goal = txy[i+1]
    time = goal[0] - start[0]
    move_x = abs(goal[1] - start[1])
    move_y = abs(goal[2] - start[2])
    if move_x + move_y <= time:
        if (time - (move_x + move_y)) % 2 == 0:
            pass
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 27380
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = [i]*2
    A[i][0] = int(input())

B = sorted(A)
# print(B)
max_index = B[N-1][1] + 1
max_2_index = B[N-2][1]+1
for j in range(N):
    if j + 1 == max_index:
        print(B[N-2][0])
    else:
        print(B[N-1][0])


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

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

  long long sum = 0;
  for (int i=0; i<n; i++) {
    long long num;
    cin >> num;
    sum += num;
  }

  if (sum%2 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


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

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

  std::string A, B, C;
  std::cin >> A >> B >> C;

  int res = 0;
  for (int i = 0; i < N; ++i) {
    if (A[i] == B[i] && B[i] == C[i]) continue;
    if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) ++res;
    else res += 2;
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define REP(i,n) for (int i = 0; i < n; ++ i)
#define FOR(i,a,b) for (int i = a; i <= b; ++ i)
#define FORD(i,b,a) for (int i = b; i >= a; -- i)
#define task ""
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef vector<int> vi;

const int N = 5005;
set<string> data;
string s, tmp[N], minstr;
int k, save;

int main() {
    //freopen(task".inp", "r", stdin);
    //freopen(task".out", "w", stdout);
    cin >> s >> k;
    int n = s.size();
    REP(i, n) tmp[i] = s[i];
    FOR(z, 1, k) {
        while (1) {
            minstr = "";
            REP(i, n) if (tmp[i] != "" && (tmp[i] < minstr || minstr == ""))
                minstr = tmp[i], save = i;
            if (data.find(minstr) == data.end()) {
                data.insert(minstr);
                if (z == k) cout << minstr;
                break;
            }
            if (n - save == minstr.size()) tmp[save] = "";
            else tmp[save] += s[save + (int)tmp[save].size()];
        }
    }
}


Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, M: int):
    unit = (N-M)*100 + 1900*M
    tim = unit
    p0 = 0.5**M
    print(int(unit/p0))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    ll N, M;
    in >> N >> M;
    ll p[100000] = {0};
    string s[100000] = {};
    vector<bool> accepted(100000, false);
    vector<ll> wa_counts(100000, 0);
    REP(i, M) {
        in >> p[i] >> s[i];
        p[i]--;
        if (s[i] == "AC") {
            accepted[p[i]] = true;
        }
        if (s[i] == "WA" && !accepted[p[i]]) {
            wa_counts[p[i]]++;
        }
    }
    ll corrects = 0;
    ll penalties = 0;
    REP(i, N) {
        if(accepted[i]) {
            corrects++;
            penalties += wa_counts[i];
        }
    }
    out << corrects << " " << penalties << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  ll N, K;
  cin >> N >> K;

  N = N % K;

  cout << min(N, K-N) << endl;



  return 0;
}


Measured memory_bytes: 256
N, W = map(int, input().split())
w, v = [0] * N, [0] * N

for i in range(N):
    w[i], v[i] = map(int, input().split())

V = sum(v)
# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値
dp = [[float("inf")] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0

for i in range(N):
    for j in range(V + 1):
        # i+1番目を選ぶ場合
        if j - v[i] >= 0:
            dp[i + 1][j] = dp[i][j - v[i]] + w[i]
        # i+1番目を選ばない場合
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

# dp[N][j]がW以下であるようなjの最大値が答えになる
ans = 0

for j in reversed(range(V + 1)):
    if dp[N][j] <= W:
        ans = j
        break

print(ans)


Measured memory_bytes: 312016
ls = list(map(int, input().split()))
count5, count7, ans = 0, 0, "NO"

for digit in ls:
    if digit == 5:
        count5 += 1
    elif digit == 7:
        count7 += 1

if count5 == 2 and count7 == 1:
    ans = "YES"

print(ans)


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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9

const int MOD = 1e9+7;

typedef long long ll;
typedef pair<int,int> pii;

ll POWER[65];
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
ll inv(ll x) {return power(x,MOD-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
const int MAXN = 1e5+5;
int num[MAXN];
int in[MAXN];
int main() {
//	freopen("TASK.in","r",stdin);	
//	freopen("TASK.out","w",stdout);
//	precompute();
	int n,m;
	cin>>n>>m;
	for(int i=2;i<=n;i++) in[i]=-1,num[i]=1;
	in[1]=1;
	num[1]=1;
	while(m--) {
		int x,y;
		scanf("%d%d",&x,&y);
		num[y]++;
		num[x]--;
		if(in[x]==1 and num[x]==0) in[y]=1,in[x]=-1;
		else if(in[x]==1) in[x]=0,in[y]=0;
		else if(in[x]==0) in[y]=0;
		if(num[x]==0) in[x]=-1;
	}
	int ans=0;
	for(int i=1;i<=n;i++) if(in[i]==0 or in[i]==1) ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  char a[t+4];
  scanf("%s",a);
  int i=0,count=0;
  
  while(i<=t+4)
  {
    if((a[i]=='A')&&(a[i+1]=='B')&&(a[i+2]=='C'))
      count++;
    i++;
  }
  cout<<count;
}
      

Measured memory_bytes: 256
import java.util.*
fun main(args:Array<String>) {
    val (N,M) = readLine()!!.split(" ").map(String::toInt)
    val switch_pattern = (1..M).map {
        val line = readLine()!!.split(" ").map(String::toInt)
        val k = line[0]
        assert(k == line.size - 1 )
        line.slice(1..k)
    }
    val pm = readLine()!!.split(" ").map(String::toInt)
    assert(pm.size == M)
    var count = 0
    var pattern_integer = 0 
    while(pattern_integer < 1 shl N) {
        val ok_pattern = (0.until(M)).all { index ->
            val x = switch_pattern[index].filter {s -> ((1 shl (s-1)) and pattern_integer) > 0}.size
            x % 2 == pm[index]
        }
        count += if(ok_pattern) {1} else {0}
        pattern_integer = pattern_integer + 1
    }
    println(count)
}

Measured memory_bytes: 38260
#include <iostream>
#include <vector>
#include <algorithm>
#define LL long long

int main(){
	int k, mySize=1, i;
	std::string x;
	std::cin >> x >> k;

	std::vector<std::string> subStrings;
	int x_size = x.size();
	int minValue = std::min(5,x_size);

	while(mySize<=minValue){
		for(i=0;i<=x_size-mySize;i++){
			subStrings.push_back(x.substr(i,mySize));
		}
		mySize++;
	}

	std::sort(subStrings.begin(),subStrings.end());
	subStrings.resize(std::unique(subStrings.begin(), subStrings.end()) - subStrings.begin() );

	std::cout << subStrings[k-1] << std::endl;
	return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
using LL = long long;
const int mod = 998244353;

LL f[3030][3030][3];
int a[3030];

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

	for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);

	f[0][0][0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= s; ++j)
		{
			(f[i][j][0] += (f[i - 1][j][0])) %= mod;
			(f[i][j][1] += (f[i - 1][j][0] + f[i - 1][j][1])) %= mod;
			(f[i][j][2] += (f[i - 1][j][0] + f[i - 1][j][1] + f[i - 1][j][2])) %= mod;
			if (j - a[i] >= 0)
			{
				(f[i][j][1] += (f[i - 1][j - a[i]][0] + f[i - 1][j - a[i]][1])) %= mod;
				(f[i][j][2] += (f[i - 1][j - a[i]][0] + f[i - 1][j - a[i]][1])) %= mod;
			}
		}
	}

	printf("%lld\n", f[n][s][2]);

	return 0;
}

Measured memory_bytes: 215168
k = int(input())
if k % 2 == 0 & k % 5 == 0:
    print(-1)
    exit()

x = 7 % k
s = set()
ans = -1
for i in range(1,k+1):
    if x == 0:
        ans = i
        break
    s.add(x)
    x = (10 * x + 7) % k
    i += 1

print(ans)

Measured memory_bytes: 77944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader 	reader  = new BufferedReader(new InputStreamReader(System.in));
		List<Integer[]> list	= new ArrayList<Integer[]>();

		for(int i = 0, loopMax = Integer.parseInt(reader.readLine());i < loopMax; i++){
			int cell = Integer.parseInt(reader.readLine());
			String[] valueListStrings = reader.readLine().split(" ");

			int crime = 0, decent = 0;
			for(int j = 0; j < valueListStrings.length - 1; j++){
				int tmp = (Integer.parseInt(valueListStrings[j]) - Integer.parseInt(valueListStrings[j + 1]));

				if(tmp < crime)			crime = tmp;
				else if(tmp > decent)	decent= tmp;
			}
			list.add(new Integer[]{Math.abs(crime), decent});
		}

		for (Integer[] integers : list) {
			System.out.println(integers[0] + " " + integers[1]);
		}
	}
}

Measured memory_bytes: 11000
/*Author--Vishwas Agrawal*/
/*Author--Vishwas Agrawal*/
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define test ll t; cin>>t; while(t--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define M 1000000007LL
#define input(v,n) inc(i,0,n){ll x; cin>>x; v.pb(x);}
#define print(v,n)   inc(i,0,n){cout<<v[i]<<" ";}
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define inc(i,a,n) for (ll i=a;i<n;i++)
#define dec(i,a,n) for (ll i=n-1;i>=a;i--)
long long binpow(long long base, long long exp, long long  mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
long long mod(long long x){
return ((x%M+M)%M);
}

long long add(long long a, long long b){
return mod(mod(a)+mod(b));
}

long long mul(long long a, long long b){
return mod(mod(a)*mod(b));
}

int main()
{
  ll n;
  cin>>n;
  cout<<mod(binpow(10,n,M)-2*binpow(9,n,M)+binpow(8,n,M));
   return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	string str;
	std::string abc = "abcdefghijklmnopqrstuvwxyz";
	int count[26] = {0};
	while(getline(cin, str)) {
		transform(str.begin(), str.end(), str.begin(), ::tolower);
		for (int i=0; i < str.length(); i++) {
			for (int j=0; j < abc.length(); j++) {
				if (str[i] == abc[j]) {
					count[j]++;
				}
			}
		}
	}
	
	for (int i=0; i < abc.length(); i++) {
		cout << abc[i] << " : " << count[i] << "\n";
	}
	return 0;
}


Measured memory_bytes: 3180
#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<ll, ll> 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 cnt[100];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    long long k;
    cin >> s >> k;
    int n = s.length();
    if(n == 1){
        cout << k/2 << endl;
        return 0;
    }
    int p = 0;
    char pre = s[0];
    for(int i = 0; i < n; i++){
        if(s[i] == pre){
            cnt[p]++;
        }
        else{
            cnt[++p]++;
            pre = s[i];
        }
    }
    if(p == 0){
        cout << n*k/2 << endl;
        return 0;
    }
    long long ans = 0;
    for(int i = 0; i <= p; i++){
        ans += cnt[i]/2;
    }
    ans *= k;
    if(s[0] == s[n-1])
        ans -= (cnt[0]/2 + cnt[p]/2 - ((cnt[0]+cnt[p])/2)) * (k-1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=2*1e5+5;
const int mod=1e9+7;
int n,a[maxn],b[maxn];
ll inv[4005],f[4005][4005],ans,fac[8005];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

void pre(){
	fac[1]=inv[1]=1; 
	go(i,4001,2){
		inv[i]=-(mod/i)*inv[mod%i];
		inv[i]=(inv[i]%mod+mod)%mod;
	}
	go(i,4001,2)
		inv[i]=(inv[i]*inv[i-1])%mod;
	go(i,8001,2)
		fac[i]=(fac[i-1]*i)%mod;
}

inline ll work(int i){
	return fac[a[i]*2+b[i]*2]*inv[a[i]*2]%mod*inv[b[i]*2]%mod;
}

int main(){
	n=rd(); pre();
	go(i,n+1,1) a[i]=rd(),b[i]=rd();
	go(i,n+1,1) f[2000-a[i]][2000-b[i]]++;
	go(i,4001,0)
		go(j,4001,0){
			if(i > 0) f[i][j]=(f[i][j]+f[i-1][j])%mod;
			if(j > 0) f[i][j]=(f[i][j]+f[i][j-1])%mod;
		}
	go(i,n+1,1)	ans=(ans+f[a[i]+2000][b[i]+2000])%mod;
	go(i,n+1,1) 
		ans=(ans-work(i))%mod;
	printf("%lld",(ans*inv[2]%mod+mod)%mod);
	return 0;
}//Faze


Measured memory_bytes: 127232
#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define itrep(at)	for(auto it=at.begin();it!=at.end();it++)
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971

#define MAX 100005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	char ch;
	db aa,bb,cc;
	string s1,s2,s3;
    lli i,j,k,a,b,c,n,m,sum=0,ans=0,temp;
    cin >> a;
    b=a/500;
    ans+=b*1000;
    a-=b*500;
    b=a/5;
    ans+=b*5;
    cout << ans;
    
    
    return 0;
}

















/* UJJWAL KESHRI */

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9

using namespace std;

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


int main() {
    int N;
    cin >> N;
    if (N >= 4) {
        int half = N / 2;
        if (half % 2 == 1) {
            half += 1;
        }
        int quarter = N / 4;
        if (quarter % 2 == 1) {
            quarter += 1;
        }
        
        int num = 0;
        for (int i = 0; i < half; ++i) {
            num += 2;
            if (num % 3 == 0) {
                num += 2;
            }
            printf("%d ", num);
        }
        num = -3;
        for (int i = 0; i < quarter; ++i) {
            num += 6;
            printf("%d ", num);
        }
        num = 0;
        for (int i = 0; i < N - half - quarter; ++i) {
            num += 6;
            printf("%d ", num);
        }
        printf("\n");
        
    }
    else if (N == 3) {
        printf("2 5 63\n");
    }
    
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

class Program
{

	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int N = int.Parse(input[0]);
		long D = int.Parse(input[1]);

		int count = 0;

		for(int i = 0; i < N; i++)
        {
			string[] input2 = Console.ReadLine().Split(' ');
			long x = int.Parse(input2[0]);
			long y = int.Parse(input2[1]);

            if (x * x + y * y <= D * D) count++;
        }


        Console.WriteLine(count);
    }
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int FFTMOD = 1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-12;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

void solve() {
    multiset<string> st;
    FOR(i, 0, 3) {
        int x; cin >> x;
        while (x--) {
            string s = "";
            s += char('a' + i);
            st.insert(s);
        }
    }
    while (sz(st) > 1) {
        string s = *st.begin();
        string t = *st.rbegin();
        st.erase(st.find(s));
        st.erase(st.find(t));
        st.insert(s + t);
    }
    cout << *st.begin() << "\n";
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    solve();
    if (!JUDGE_ONLINE) {
        cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}


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

int gcd(long long a,long long b){
    if(b == 0) return a;
    return gcd( b , a % b);
}

int find(string str, const string& word) {
  int count = 0;
  for (string::size_type pos = 0; (pos = str.find(word, pos)) != string::npos; pos += word.size()) {
    ++count;
  }
  return count;
}

int main(){
    int r , D;
    long long  x_2000;
    cin >> r >> D >> x_2000;
    long long x_pre = x_2000;
    long long x_next;
    for(int i = 0; i < 10; i++){
        x_next = (long long) r * x_pre - (long long)D;
        x_pre = x_next;
        cout << x_next << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	string s;
	cin>>s;
	int n = s.size();
	int m;
	if(n & 1) m = n/2+1;
	else m = n / 2;
	int ans  =0;
	for(int i = 0; i < n; i++){
		if(i < m && s[i] =='p') ans--;
		else if(i >= m && s[i]=='g') ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

r=INT()

print(3*r**2)


Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<cstdlib>
#include<queue>
#include<list>
using namespace std;

int main(){
    char a, b;
    cin>>a>>b;
    if((a=='H'&&b=='H')||(a=='D'&&b=='D'))cout<<'H'<<endl;
    else cout<<'D'<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <iostream>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
	ll I, O, T, J, L, S, Z;
	scanf("%lld%lld%lld%lld%lld%lld%lld", &I, &O, &T, &J, &L, &S, &Z);

	ll ans = 0;
	ans = (I/2*2)+(J/2*2)+(L/2*2)+O;
	if(I%2 && J%2 && L%2) {
		ans = I+O+J+L;
	}
	else if(I && J && L) {
		I--; J--; L--;
		ans = max(ans, (I/2*2)+(J/2*2)+(L/2*2)+O+3);
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>
// 多倍長整数型
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
     
#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;

int main(){
    int n;
    string s;
    cin >> n >> s;
    ll r = 0, w = 0;
    rep(i, n){
        if(s[i] == 'R')r++;
        else w++;
    }
    ll res = 0;
    rep(i, r){
        if(s[i] == 'W')res++;
    }
    cout << res << endl;
}





Measured memory_bytes: 3716
#include<bits/stdc++.h>
#define ll long long
#define P pair<ll ,ll>
using namespace std;

int main(){
    ll n ,m;
    cin >> n >> m;
    priority_queue<ll ,vector<ll> ,greater<ll>> a;
    for(int i=0;i<n;i++) {
        ll x; cin >> x;
        a.push(x);
    }

    priority_queue<P> que;
    for(int i=0;i<m;i++){
        ll b ,c;
        cin >> b >> c;
        que.push(P {c ,b});
    }

    bool conti = true;
    while(conti && !que.empty()){
        P p = que.top();que.pop();
        for(int i=0;i<p.second;i++){
            ll t = a.top();a.pop();
            if(t >= p.first){
                if(i == 0) conti = false;
                a.push(t);
                break;
            }else{
                t = p.first;
                a.push(t);
            }
        }
    }

    ll sum = 0;
    for(int i=0;i<n;i++){
        sum += a.top();
        a.pop();
    }

    cout << sum << endl;

}


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

int main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);cout.tie(NULL);
    long long int h,n,sum = 0,k;
    cin>>n>>k;
    int a[n];
    for(int i = 0 ; i < n ; i++){
      cin>>a[i];
    }
    sort(a,a+n);
    for(int  i = 0 ; i < n-k ; i++)sum += a[i];
    cout<<sum<<'\n';
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define LL long long
#define PI pair<int,int>
#define PL pair<LL,LL>
#define st first
#define nd second
#define all(x) x.begin(),x.end()

using namespace std;

const int MX = 1e5 + 5;
int a[MX];
int n,q,k;

int main(){
    cin >> n >> k >> q;
    memset(a,0,sizeof(a));
    for(int i=0 ; i<q ; ++i){
        int x;
        cin >> x;
        a[x]++;
    }
    for(int i=1 ; i<=n ; ++i){
        a[i] -= q;
        a[i] += k;
        if(a[i] > 0)
            puts("Yes");
        else
            puts("No");
    }
}  

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{ int a,b,c;
cin>>a>>b>>c;
  if(a==b && a!=c)
    cout<<"Yes";
    else if(b==c && b!=a)
     cout<<"Yes";
  else if (c==a && c!=b)
    cout<<"Yes";
  else 
    cout<<"No";
  return 0;
}

Measured memory_bytes: 256
/**
 * @brief  : c++ code for AtCoder
 * @author : rk222
 * @created: 2019.05.26 20:48:29
 */

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

#define disp(x) cout << #x << ": " << x << endl
#define disp_vec(v)                                                                           \
    cout << #v << ":";                                                                        \
    rep(i, v.size()) cout << " " << v[i];                                                     \
    cout << endl

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

int n, m;
int k[15], s[15][15];
int p[15];

int ret = 0;

void dfs(vector<bool> isOn, int i) {
    if (i == n) {
        rep(j, m) {
            int cnt = 0;
            rep(l, k[j]) {
                if (isOn[s[j][l]])
                    cnt++;
            }
            if (cnt % 2 != p[j])
                return;
        }
        ret++;
        return;
    }

    isOn[i] = true;
    dfs(isOn, i + 1);
    isOn[i] = false;
    dfs(isOn, i + 1);
}

int main() {
    scanf("%d%d", &n, &m);
    rep(i, m) {
        scanf("%d", &k[i]);
        rep(j, k[i]) {
            int st;
            scanf("%d", &st);
            s[i][j] = st - 1;
        }
    }
    rep(i, m) scanf("%d", &p[i]);

    vector<bool> isOn(n);

    rep(i, n) {
        isOn[i] = false;
    }

    dfs(isOn, 0);

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

    /* --------------------------------- */
    return 0;
}

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

using namespace std;

typedef long long ll;

const int Z = 2019;

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

    string s;
    cin >> s;

    int pow10[s.length()];
    for (int i = 0; i < s.length(); i++) {
        pow10[i] = i == 0 ? 1 : pow10[i-1] * 10 % Z;
    }

    int cnt[Z] = {1};
    ll ans = 0;
    int cur = 0;
    for (int i = 0; i < s.length(); i++) {
        cur = (cur * 10 + (s[i] - '0')) % Z;
        ans += cnt[cur*pow10[s.length()-1-i]%Z];
        cnt[cur*pow10[s.length()-1-i]%Z]++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4532
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T,V> &x){cerr<<'{';__print(x.first);cerr<<',';__print(x.second);cerr<<'}';}
template<typename T>
void __print(const T &x){int f=0;cerr<<'{';for(auto &i:x)cerr<<(f++ ? "," : ""),__print(i);cerr<<"}";}
void _print(){cerr<<"]\n";}
template<typename T,typename... V>
void _print(T t, V... v) {__print(t);if(sizeof...(v))cerr<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define sz(x) (int)x.size()                         					
#define all(x) x.begin(), x.end()           		
#define lb lower_bound                  	
#define ub upper_bound             		
                                   	
typedef long long ll;           		
typedef pair<int, int> pii;     	
typedef pair<ll, ll> pll;       	
typedef long double ld;
          						
template<typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;    
template<typename T> void print(T x){cerr<<x<<'\n';}
inline ll bip(ll x,ll n,ll mod){ll res=1;while(n){if(n&1){res=(res*x)%mod;}x=(x*x)%mod;n>>=1;}return res;}                 		
																															 
const int maxn = 1e9;
const ll inf = 1e18;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 2e5 + 10;
		
											        	 	
void solve() {
	int n, m, k;
	cin >> n >> m >> k;

	vector <ll> a(n + 1, 0), b(m + 1, 0);
	for (int i = 1; i <= n; i++) {
		int x; cin >> x;
		a[i] = a[i - 1] + x;
	}
	for (int i = 1; i <= m; i++) {
		int x; cin >> x;
		b[i] = b[i - 1] + x;
	}


	int ans = 0;
	for (int i = 0; a[i] <= k && i <= n; i++) {
		ans = max(ans, i + int(ub(all(b), k - a[i]) - b.begin()) - 1);
	}
	cout << ans;
}
 
int main() {
    SpeedForce;
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
        cout << '\n';
    }
}    

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

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



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <map>
 
using namespace std;
typedef unsigned long long ull;
 

int main(int argc, char const *argv[]) {
    int N;
    string S;
    cin >> N;
    cin >> S;
 
    vector<map<char, int>> count(N);
    for (int i = N-1; i >= 0; i--) {
        if (i < N-1) {
            count[i]['R'] = count[i+1]['R'];
            count[i]['G'] = count[i+1]['G'];
            count[i]['B'] = count[i+1]['B'];
        }
        count[i][S[i]] += 1;
    }

    ull ans = 0;
    for (int i = 0; i < N-2; i++) {
        for (int j = i+1; j < N-1; j++) {
            if (S[i] == S[j]) continue;
            char left;
            if (S[i] != 'R' && S[j] != 'R') {
                left = 'R';
            } else if (S[i] != 'G' && S[j] != 'G') {
                left = 'G';
            } else if (S[i] != 'B' && S[j] != 'B') {
                left = 'B';
            }
            ans += count[j+1][left];
            int k_ng = j*2 - i;
            if (k_ng < N && S[k_ng] == left) {
                ans -= 1;
            }
        }
    }

    cout << ans << endl;
 
    return 0;
}

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

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

int n,k;
LL x[100000];
int zp;

int main(){
  cin>>n>>k;
  REP(i,n)
    cin>>x[i];
  LL ret = LLONG_MAX;
  REP(i,n){
    if(x[i] >= 0){
      zp=i;
      break;
    }
  }

  if(x[n-1]<=0){
    ret = -x[n-k];
    cout<<ret<<endl;
    return 0;
  }
  if(x[0]>=0){
    ret = x[k-1];
    cout<<ret<<endl;
    return 0;
  }
  
  if(n-zp>=k)
    ret = min(ret,x[zp+k-1]);
  if(zp>=k || (x[zp]==0 && zp+1>=k)){
    ret = min(ret,-x[zp-k]);
    if(x[zp]==0 && zp+1>=k)
      ret = min(ret,-x[zp+1-k]);
  }
  REP(i,n-k+1){
    if(x[i]<=0 && x[i+k-1]>=0){
      ret = min(min(ret,x[i+k-1]-2*x[i]),2*x[i+k-1]-x[i]);
    }
  }
  
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using sl = stack<ll>;
using ql = queue<ll>;

const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};


void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

int binary_search(ll x, vl a){
    auto ite = lower_bound(ALL(a), x);
    if(ite != a.end() && *ite == x) {
        return ite - a.begin() ;
    } else {
        return -1;
    }

}

ll modpow(ll a, ll n, ll mod) {
    if(n == 0)
        return 1;
    if(n == 1)
        return a % mod;
    if(n % 2 == 1)
        return (a * modpow(a, n - 1, mod)) % mod;
    ll t = modpow(a, n / 2, mod);
    return (t * t) % mod;
}

int main() {
    string S, T, U;
    ll A, B;
    cin >> S >> T >> A >> B >> U;
    if(S == U){
        cout << A - 1 << " " << B << endl;
    } else {
        cout << A << " " << B - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
N = int(input())
l = [int(x) for x in input().split()]
ans = 1
wa = sum(l)
kosuu = 1 - l[0]
flag = 0
if N == 0:
    if l[0] == 1:
        print(1)
        exit()
    else:
        print(-1)
        exit()
for i in range(1,N):
    if  flag == 0:
        kosuu = kosuu * 2
    if kosuu >= wa:
        flag = 1
        kosuu = wa
    ans += kosuu
    kosuu = kosuu - l[i]
    wa = wa-l[i]
    if kosuu <= 0:
        print(-1)
        exit()
if kosuu*2 < l[N]:
    print(-1)
else:
    print(ans+l[N])

Measured memory_bytes: 20148
import java.util.Scanner;

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

		double r = sc.nextDouble();
		double pi = Math.PI;

		double area = pi*r*r;
		double length = 2*pi*r;

		System.out.printf("%f %f", area, length);
	}
}

Measured memory_bytes: 19016
package main

import (
	"fmt"
)

var i = 1

func main() {
	var n int
	fmt.Scan(&n)

	call(n)
}

func call(n int) {
	for {
		x := i
		if checkNum(x) {
			include3(x)
		}
		if endCheckNum(n) {
			break
		}
	}
	fmt.Println()

}

func checkNum(x int) bool {
	if x%3 == 0 {
		fmt.Printf(" %d", i)
		return false
	}
	return true
}

func include3(x int) {
	if x%10 == 3 {
		fmt.Printf(" %d", i)
		return
	}
	if x/10 != 0 {
		include3(x / 10)
	}
}

func endCheckNum(n int) bool {
	i++
	if i <= n {
		return false
	}
	return true
}


Measured memory_bytes: 1124
#include <stdio.h>
#include <math.h>

int main(void){
  long long int a;
  long double b;
  long long int p;
  
  scanf("%lld %llf", &a, &b);
  
  p=(long long int)floorl(a*b);
  
  printf("%lld", p);
  
}

Measured memory_bytes: 2224
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define all(a)                      a.begin(), a.end()
#define pb                          push_back
#define ll							long long
#define index(a)            		order_of_key(a)
#define value(a)					find_by_order(a)
#define count_1 					__builtin_popcount
#define mod(x, m)					((((x) % (m)) + (m)) % (m))
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a[4];
	for(int i=0;i<4;i++)cin>>a[i];
	sort(a,a+4);
	if(a[0]!=1 ||a[1]!=4 ||a[2]!=7 ||a[3]!=9)cout<<"NO";
	else cout<<"YES";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, ok = 0;
vector<int> a;

bool f(int mid, bool out = 0){
   vector<int> b = a;

   int m0 = 2*mid;
   vector<int> v;
   if(out)v.pb(m0);
   int sum = 0;

   for (int i = 0; i < n; ++i)
   {
      int x = i-1, y = i;
      if(x < 0)x += n;
      assert(m0 % 2 == 0);
      sum += m0;
      b[x] -= m0 / 2;
      b[y] -= m0 / 2;
      m0 = b[y] * 2;
      if(out){
         v.pb(m0);
      }
   }

   if(out){
      for (int i = 0; i < n; ++i)
      {
         cout<<v[i]<<' ';
      }
      assert(v.back() == 0);
   }

   return sum-ok <= 0;
}

int32_t main(){_

   cin>>n;
   a.resize(n);
   

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

   int low = 0, high = 1e10, ans = 0;     

   while(low <= high){
      int mid = (low + high) >> 1;
      if(f(mid)){//cond => sum < 0
         ans = mid;
         low = mid + 1;
      }
      else{
         high = mid-1;
      }
   }

   f(ans, 1);

   return 0;
}

Measured memory_bytes: 4720
n,m = map(int,input().split())
 
lis = [[] for i in range(n)] #なぜか知らんけど[[]]*nじゃだめらしい
 
for i in range(m):
  a,b = map(int,input().split())
  lis[a-1].append(b-1)
  lis[b-1].append(a-1)
 
 
if set(lis[-1]).isdisjoint(set(lis[0])): #交叉しているか？
    print('IMPOSSIBLE')
else:
  print('POSSIBLE')

Measured memory_bytes: 48596
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N;
    string s;
    int p;
    cin>>N;
    vector<pair<string,int>> vec;
    int d[1000];
    rep(i,N){
        cin>>s>>p;
        d[p]=i+1;
        vec.push_back(make_pair(s,-1*p));
    }
    sort(vec.begin(),vec.end());
    rep(i,N){
        cout<<d[-1*vec[i].second]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
def c_iroha_obsession():
    # 1種しか使えない場合でも、Nの桁数+1だけ並べればいい。2種以上ならより小さい
    N, K = [int(i) for i in input().split()]
    D = set(input().split())
    for ans in range(N, 10 * N + 1):
        if set(str(ans)) & D == set():
            return ans  # ansが含む数字の集合とDの合併が空集合なら条件を満たす
    return None

print(c_iroha_obsession())

Measured memory_bytes: 3060
h,w,k=list(map(int,input().split()))

dp=[[0]*(h+2) for _ in range(w+2)]
comb=[1]*(w+5)
comb[2]=2
for i in range(3,w+1):
    for j in range(1,i):
        comb[i]+=comb[i-j-1]

dp[1][0]=1


mod=10**9+7

for hh in range(1,h+1):
    for ww in range(1,w+1):
        dp[ww][hh]+=comb[ww-1]*comb[w-ww]*dp[ww][hh-1]
        dp[ww][hh]+=comb[ww-2]*comb[w-ww]*dp[ww-1][hh-1]
        dp[ww][hh]+=comb[ww-1]*comb[w-ww-1]*dp[ww+1][hh-1]
        dp[ww][hh]%=mod

print(dp[k][h])

Measured memory_bytes: 62540
s = input()
n = len(s)
MOD = 10 ** 9 + 7

dp = [[0] * 13 for _ in range(n + 1)]
dp[0][0] = 1

for i in range(n):
    x = s[i]
    for j in range(13):
        if x == '?':
            for k in range(10):
                dp[i + 1][(10 * j + k) % 13] += dp[i][j]
                dp[i + 1][(10 * j + k) % 13] %= MOD
        else:
            k = int(x)
            dp[i + 1][(10 * j + k) % 13] += dp[i][j]
            dp[i + 1][(10 * j + k) % 13] %= MOD

print(dp[n][5])

Measured memory_bytes: 61788
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod 1000000007
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[100000],y[100000];
signed main(){
	int a,b,c,d;
	cin>>a>>b;
	string s;
	cin>>s;
	for(int i=0;i<a-1;i++){
		if(s[i]=='A'&&s[i+1]=='C'){
			y[i+1]++;
			x[i]++;
			i++;
		}
	}
	for(int i=1;i<a;i++){
		y[i]+=y[i-1];
	}
	f(i,b){
		cin>>c>>d;
		c-=2;
		d--;
		if(c>=0&&x[c]) c++;
		cout<<y[d]-y[c]<<endl;
	}
    return 0;
}


Measured memory_bytes: 2560