akhauriyash/Code-Regression huggingface dataset:
#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>


#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()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}


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

const int MOD = 1e9 + 7;
int main(){
    int n, k;
    cin >> n >> k;
    int res = 1;
    rep(i, n){
        res = min(res * 2, res + k);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int x;
	cin >> x;
	
	int maxp = 1;
	for (int i = 2; i * i <= x; i++) {
		int t = i * i;
		while (t <= x) {
			if (t > maxp) maxp = t;
			t *= i;
		}
	}

	cout << maxp << endl;

	return 0;
}


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

using namespace std;

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

  int n; cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string s; cin >> s;
    mp[s]++;
  }
  vector<pair<int, string>> v;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    v.push_back(make_pair(it->second, it->first));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  int cnt = v[0].first;
  vector<string> ans;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first == cnt) {
      ans.push_back(v[i].second);
    }
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 31596
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)


int main() {
    string s;
    cin >> s;
    int ans = 0;
    for(char c : s){
        if(c == 'o'){
            ans += 1;
        }
    }

    cout << 700 + ans * 100 << endl;
}


Measured memory_bytes: 256
from itertools import combinations
from collections import defaultdict

N=int(input())
L=list(map(int,input().split()))
count=defaultdict(int)
for i in range(N):
    count[L[i]]+=1

L=list(set(L))
ans=0
for a,b,c in list(combinations(L,3)):
    if a>abs(b-c) and b>abs(c-a) and c>abs(a-b):
        ans+=count[a]*count[b]*count[c]
print(ans)

Measured memory_bytes: 20768
#include<stdio.h>
#include<string.h>
int main(){
  char odd[51],even[51];
  scanf("%s\n",odd);
  scanf("%s\n",even);
  int l1= strlen(odd);
  int l2 = strlen(even);
  int l = l1+l2;
  int i=0,j=0,k=0;
  char str[102];
  for(k=0;k<l;k++){
    if(k%2==0){
      str[k]=odd[i];
      i++;
    }
    else{
      str[k]=even[j];
      j++;
    }
  }
  str[l]='\0';
  printf("%s",str);
  return 0;
}

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

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<ll, ll> Pair;
typedef vector<Pair> VP;

#define MOD 1000000007
#define times(n) rep(_idx, n)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define in(a, l, r) (l <= a && a < r)
#define pb push_back
#define mk make_pair
#define out(x) cout << (x) << endl;
#define DU(x) cerr << #x << " = " << (x) << endl;

template<typename _Ty>ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "[]";return ostr;}ostr << "[" << v.front();for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}ostr << "]";return ostr;}

VVI edges;
vector<bool> used;
VI color; 
int main() {
    int N; cin >> N;
    VI a, b; a.resize(N - 1); b.resize(N - 1);
    rep(i, N - 1) cin >> a[i] >> b[i];

    edges.resize(N);
    rep(i, N - 1) {
        edges[a[i] - 1].pb(i);
        edges[b[i] - 1].pb(i);
    }

    color.resize(N - 1);
    fill(all(color), 0);

    used.resize(N - 1);
    for (VI edge: edges) {
        fill(all(used), false);
        for(int e: edge) used[color[e]] = true;
        
        int col = 1;
        for(int i: edge) {
            if(color[i] != 0) continue;
            while(used[col]) col++;
            color[i] = col++;
        }
    }
    int m = 0;
    rep(i, N - 1) m = max(m, color[i]);
    out(m);
    rep(i, N - 1) out(color[i]);
    return 0;
}


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

int main()
{
  long long a, b, k;
  cin >> a >> b >> k;

  if (a > k)
  {
    a -= k;
  }
  else
  {
    k -= a;
    a = 0;

    if (b > k)
    {
      b -= k;
    }
    else
    {
      b = 0;
    }
  }

  cout << a << ' ' << b << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int FAVOURITE_NUMBER = 753;

    public static int process(TestCase testCase) {
        String S = testCase.S;
        int min = Integer.MAX_VALUE;

        for (int i = 2, length = S.length(); i < length; ++i) {
            final int num = Integer.valueOf(S.substring(i - 2, i + 1));
            min = Math.min(min, diff(num));
        }
        return min;
    }

    private static int diff(int num) {
        return Math.abs(FAVOURITE_NUMBER - num);
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final int result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        sc.close();
        return new TestCase(S);
    }

    private static void output(int result) {
        System.out.println(result);
    }

    public static class TestCase {
        final String S;

        public TestCase(String S) {
            this.S = S;
        }
    }
}


Measured memory_bytes: 23380
#include <stdio.h>
#include <stdint.h>

uint64_t f(uint64_t n) {
  if(n % 2) {
    return (n / 2) % 2;
  } else {
    return n + (((n-1) / 2) % 2);
  }
}

int main(void) {
  uint64_t A, B;
  scanf("%ld%ld", &A, &B);
  uint64_t XOR = f(A-1) ^ f(B);
  printf("%lu\n", XOR);
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3

class UnionFind():
    def __init__(self, n):
        self.parents = list(range(n))
        self.size = [1] * n

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.size[x] < self.size[y]:
                x,y = y,x
            self.parents[y] = x
            self.size[x] += self.size[y]

def main():
    N, M = map(int, input().split())
    p = list(map(int, input().split()))
    
    uf = UnionFind(N)
    for _ in range(M):
        x, y = map(int, input().split())
        uf.union(x-1,y-1)
        # print(uf.parents)
    
    adj = [[] for _ in range(N)]
    for i in range(N):
        adj[uf.find(i)].append(i)
    
    ans = 0
    for i in range(N):
        tmpP = set()
        for a in adj[i]:
            tmpP.add(p[a]-1)
        # print(tmpP,set(adj[i]))
        ans += len(tmpP & set(adj[i]))
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 44180
// A.

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<int> h(n), cost(n, 1 << 30);
	for (int i = 0; i < n; ++i) {
		cin >> h[i];
	}
	cost[0] = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 1; j <= 2; ++j) {
			if (i + j < n) {
				cost[i + j] = min(cost[i + j], cost[i] + abs(h[i + j] - h[i]));
			}
		}
	}
	cout << cost[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe





int s(int n){
	int sum=0;
	while(n!=0){
		sum+=n%10; 
		n=n/10;
	}
	return sum;
}

int main(void){ios::sync_with_stdio(false);cin.tie(0);
///////////////////////////////////////////////////////
int d,n;
cin >> d >> n;
if(d==0){
	if(n==100){
		cout << 101 << endl;
		return 0;
	}
	cout << n << endl;
	}


else if(d==1){
	if(n==100){
		cout << 10100 << endl;
		return 0;
	}
	cout << 100*n << endl;
}

else if(d==2){
	if(n==100){
		cout << 1010000 << endl;
		return 0;
	}
	cout << 10000*n << endl;
}
 




///////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100002
#define mod 1000000007
#define lld long long 
int main()
{
   lld n,k; cin>>k>>n;
   lld a[n];
   for(int i=0;i<n;++i)cin>>a[i];
   sort(a,a+n);
   lld ans=a[n-1]-a[0];
   for(int i=1;i<n;++i){
    lld bb=a[i]-a[i-1];
    bb=k-bb;
    if(ans>bb)ans=bb;
   }
   cout<<ans;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long double now = 100;
  ll x;
  cin >> x;
  ll ans = 0;

  REP(i, 1e7) {
    now = floor(now * 1.01);
    // cout << now << endl;
    if (now >= x) {
      ans = i + 1;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
n=int(input())
c=0
if(n<105):print(0)
if(n==105):print(1)
if(n>105):
    for i in range(105,n+1,2):
        d=0
        for j in range(1,i+1):
            if(i%j==0):d+=1
        if(d==8):c+=1

    print(c)

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

using namespace std;

int N, M;
vector<vector<int>> edges;
vector<bool> visited;
int ans;

void dfs(int v) {
  visited[v] = true;
  for (int e : edges[v]) {
    if (visited[e]) continue;
    dfs(e);
  }
  bool finish = true;
  for (int i = 0; i < N; i++) {
    if (!visited[i]) {
      finish = false;
      break;
    }
  }
  if (finish) ans++;
  visited[v] = false;
}

int main() {
  cin >> N >> M;
  edges.assign(N, vector<int>());
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  visited.resize(N);
  dfs(0);
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int a[3][3];
int n;
int b[101];
bool flag[3][3];

int main(void){
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			scanf("%d",&a[i][j]);
		}
	}
	memset(flag,false,sizeof(flag));
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(a[j][k]==b[i]){
					flag[j][k]=true;
				}
			}
		}
	}
	bool ok=false;
	for(int i=0;i<3;i++){
		bool oo=true;
		for(int j=0;j<3;j++){
			if(!flag[i][j])oo=false;
		}
		if(oo){
			ok=true;
		}
	}
	for(int i=0;i<3;i++){
		bool oo=true;
		for(int j=0;j<3;j++){
			if(!flag[j][i])oo=false;
		}
		if(oo){
			ok=true;
		}
	}
	{
		bool oo=true;
		for(int i=0;i<3;i++){
			if(!flag[i][i])oo=false;
		}
		if(oo){
			ok=true;
		}
	}
	{
		bool oo=true;
		for(int i=0;i<3;i++){
			if(!flag[2-i][i])oo=false;
		}
		if(oo){
			ok=true;
		}
	}
	printf("%s\n",ok?"Yes":"No");
	return 0;
}


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

int main(){
  ll a,b;
  cin >> a >> b;
  cout << lcm(a,b) << endl;
}


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

H, W = map(int, input().split())
cell = []
for i in range(H):
    cell.append(input())

mat = np.empty((H, W))
for i in range(H):
    for j in range(W):
        if cell[i][j] == '.':
            mat[i,j] = 0
        if cell[i][j] == '#':
            mat[i,j] = 1

col_del = np.all(mat == 0, axis=0)
row_del = np.all(mat == 0, axis=1)
col_index = np.where(col_del==True)
row_index = np.where(row_del==True)
#print(col_index)

res = np.delete(mat, row_index, axis=0)
res = np.delete(res, col_index, axis=1)
#print(res)
Hn = res.shape[0]
Wn = res.shape[1]

a =''
for i in range(Hn):
    ans = []
    for j in range(Wn):
        if res[i,j] == 0:
            ans.append('.')

        if res[i,j] == 1:
            ans.append('#')
    #print(ans)
    a += '\n' + ''.join(ans)

print(a)


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

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    int a, b[m];
    int cnt = 0;

    for (int i = 0;i < m;i++) cin >> b[i];
    for (int i = 0;i < n;i++) {
        int sum = 0;
        for (int j = 0;j < m;j++) {
            cin >> a;
            sum += a*b[j];
        }
        sum += c;
        if (0 < sum) cnt++;
    }
    cout << cnt << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll N;
ll A[100005];

vector<P> lis;

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

    cin >> N;

    ll sum = 0;

    for (int i = 0;i <= N;i++){
        cin >> A[i];
        sum += A[i];
        lis.push_back(P(i,sum));
    }

    ll ans = 0;
    ll width = 1;
    ll lis_idx = 0;

    if(N != 0 && A[0] != 0){
        cout << -1 << endl;
        return 0;
    }

    if(N == 0){
        if(A[0] == 1){
            cout << 1 << endl;
        }else{
            cout << -1 << endl;
        }
        return 0;
    }

    ll st = 0;
    ll sum2 = 0;
    

    for (int i = 0;i <= N;i++){
        //cout << i << " " << width << " " << ans << " " << st << endl;
        while(true){
            if(lis_idx == lis.size()) break;
            if(lis[lis_idx].second <= width){
                ans += (lis[lis_idx].first-i+1)*(lis[lis_idx].second-st);
                st = lis[lis_idx].second;
                lis_idx++;
            }
            else break;
        }
        
        if(lis_idx < lis.size() && lis[lis_idx].first <= i){
            cout << -1 << endl;
            //cout << i << " " << width  << endl;
            return 0;
        }

        ans += (lis[lis_idx].first-i+1)*(width-st);
        st = width;
        sum2 += A[i];
        width = min(width+width-sum2,sum);
    }

    cout << ans << endl;
   
    return 0;

}

Measured memory_bytes: 5852
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    int v[n];
    repi(i, n, 0)
    {
        cin >> v[i];
    }
    sort(v, v + n);
    double ans = (v[0] + v[1]) / 2.;
    repi(i, n, 2)
    {
        ans = (v[i] + ans) / 2.;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
    int n, m, x = 0;
    cin >> n >> m >> x;
    set<int> st;
    int ct1 = 0;
    int ct2 = 0;
    REP(i, m)
    {
        int buf = 0;
        cin >> buf;
        st.insert(buf);
    }
    for (int i = x; i < n; i++)
    {
        if (st.count(i) > 0)
        {
            ct1++;
        }
    }
    for (int i = x; i > 0; i--)
    {
        if (st.count(i) > 0)
        {
            ct2++;
        }

    }

    COUT(min(ct1,ct2));

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
int main(){
    int N,K;
    int d,a;
    std::cin >>N>>K;
    int* sunuke=new int[N];
    for(int i=0;i<N;i++){
        sunuke[i]=1;
    }
    for(int i=0;i<K;i++){ //K種類のお菓子についてループ
        std::cin>>d;
        for(int j=0;j<d;j++){
            std::cin>>a;
            sunuke[a-1]=0;
        }
    }
    int sum=0;
    for(int i=0;i<N;i++){
        sum=sum+sunuke[i];
    }
    std::cout<<sum;
    //計算
    delete[] sunuke;
    return 0;
}

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

void Cont(){
    long long X;
    cin >> X;
    vector<long long> zyou5s(125);
    for(int i=0;i<125;i++){
        zyou5s.at(i) = pow(i,5);
    //      cout << i << ": " << zyou5s.at(i) << "\n";
    }
    for(int i=0;i<125;i++){
        for(int j=i+1;j<125-1;j++){
            if(X == (pow(j,5)-pow(i,5))){
                cout << j << " " << i << "\n";
                return;
            }
            else if(X ==(pow(j,5)+pow(i,5))){
                cout << j << " " << -i << "\n";
                return;
            }
        }
    }
            
}

int main()
{
	std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Cont();
}


Measured memory_bytes: 4060
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
const int nax=1e5+10;
ll dp[nax];
void max_self(ll &a,ll b){
    a=max(a,b);
}
void solve(){
    int n,W;cin>>n>>W;
    ll weight,value;
    fr(i,0,n-1){
        cin>>weight>>value;
        frr(j,W-weight,0){
            max_self(dp[j+weight],dp[j]+value);
        }
    }
    ll ans=0;
    fr(i,0,W)max_self(ans,dp[i]);
    cout<<ans<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

Measured memory_bytes: 4396
# 配るDPで解く
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [float('inf')]*N

dp[0] = 0
# 配っていく
for i in range(N):
    for j in range(i+1, min(i+1+K, N)):
        dp[j] = min(dp[j], dp[i]+abs(H[j]-H[i]))
print(dp[N-1])


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

int main(){
  long long s;
  long long x1, y1, x2, y2;
  cin >> s;
  
  x1=1000000000;
  x2=1;
  if(s==1000000000000000000)y2=1000000000;
  else y2=s/x1+1;
  y1=x1*y2-s;

  printf("0 0 %lld %lld %lld %lld\0",x1,y1,x2,y2);
  return 0;
}


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> num(n, -1);
	int pos = 1;
	for(int i = 0; i < m; ++i) {
		int r1, r2;
		cin >> r1 >> r2;
		--r1;
		if(num[r1] == -1) {
			num[r1] = r2;
		}
		else if(num[r1] != r2) {
			cout << -1;
			pos = 0;
			break;
		}
	}
	if(pos == 1) {
		if(n == 1 && num[0] == 0) {
			cout << 0;
		}
		else if(num[0] == 0) {
			cout << -1;
		}
		else if(n == 1 && num[0] == -1) {
			cout << 0;
		}
		else {
			if(num[0] == -1) cout << 1;
			else cout << num[0];
			for(int i = 1; i < n; ++i) {
				if(num[i] == -1) cout << 0;
				else cout << num[i];
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
vector<vector<int>> grh, cnt;
vector<int> ckd;
void dfs (int crr) {
  if (ckd[crr]) return;
  if (cnt[crr][0] && cnt[crr][1]) return;
  ckd[crr] = true;
  for (int nxt : grh[crr]) {
    if (ckd[nxt]) continue;
    if (s[crr] == s[nxt]) {
      cnt[crr][0]--;
      cnt[nxt][0]--;
    } else {
      cnt[crr][1]--;
      cnt[nxt][1]--;
    }
    dfs(nxt);
  }
}
int main() {
  int n, m;
  cin >> n >> m >> s;
  grh.resize(n);
  cnt.resize(n, vector<int>(2));
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    grh[a].push_back(b);
    grh[b].push_back(a);
    if (s[a] == s[b]) {
      cnt[a][0]++;
      cnt[b][0]++;
    } else {
      cnt[a][1]++;
      cnt[b][1]++;
    }
  }
  ckd.resize(n, false);
  for (int i = 0; i < n; i++) {
    dfs(i);
  }
  int flg = false;
  for (int i = 0; i < n; i++) {
    if (!ckd[i]) flg = true;
  }
  if (flg) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}

Measured memory_bytes: 24580
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	int n, ans = 0;
	cin >> n;
	vi(p)(n); vi(q)(n);
	FOR(n)
		cin >> p[i];
	FOR(n)
		cin >> q[i];

	int a = 0, b = 0, k = 0;
	while (next_permutation(ALL(p))) k++;
	a = n - k;
	k = 0;
	while (next_permutation(ALL(q))) k++;
	b = n - k;
	cout << abs(a - b) << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
#include <cstdlib>
#include <cctype>
#include <random>

using namespace std;

int main() {
    int n, max_l=0, sum_l=0;
    cin >> n;
    int l;
    for (int i=0; i<n; i++) {
        cin >> l;
        max_l = max(max_l, l);
        sum_l += l;
    }
    sum_l -= max_l;

    if (max_l < sum_l) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>

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

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printf("%s\n", c % gcd(a, b) == 0 ? "YES" : "NO");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define ps(s)     for(auto i:s){cout<<i<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll w,h,x,y;
	cin>>w>>h>>x>>y;
	double ans=w*h;
	ans=ans/2;
	bool ck=false;
	if(2*x==w and 2*y==h){ck=true;}
	cout<<sp(ans,10)<<" "<<((ck)?1:0);
}
int32_t main(){
	kehsihba();
	//init();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		//cout<<"Case "<<k<<": ";
		solve();
		//e;
	}
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
bool dp_x[8005][17005];
bool dp_y[8005][17005];
int main(){
    string s;
    cin >> s;
    int x,y;
    cin >> x >> y;
    long unsigned int i=0;
    int vx=0,vy=0;
    vector<int> v_x;
    vector<int> v_y;
    while(s[i]=='F' && i<s.length()){
        vx++;
        i++;
    }
    if(i==s.length()){
        if(vx==x && vy==y)cout << "Yes";
        else cout << "No";
        return 0;
    }
    int tmp_v=0;
    int tmp_s=0;
    while(i<s.length()){
        if(s[i]=='T'){
            if(s[i-1]=='F'){
                if(tmp_s%2==0)v_x.push_back(tmp_v);
                else v_y.push_back(tmp_v);
                tmp_v=0;
            }
            tmp_s++;
        }
        else tmp_v++;
        i++;
    }
    if(tmp_s%2==0)v_x.push_back(tmp_v);
    else v_y.push_back(tmp_v);
    dp_x[0][vx+s.length()]=true;
    dp_y[0][vy+s.length()]=true;
    for(i=1;i<=v_x.size();i++){
        for(int j=0;j<=2*s.length();j++){
            if(j-v_x[i-1]>=0)dp_x[i][j]=dp_x[i-1][j+v_x[i-1]]|dp_x[i-1][j-v_x[i-1]];
            else dp_x[i][j]=dp_x[i-1][j+v_x[i-1]];
        }
    }
    for(i=1;i<=v_y.size();i++){
        for(int j=0;j<=2*s.length();j++){
            if(j-v_y[i-1]>=0)dp_y[i][j]=dp_y[i-1][j+v_y[i-1]]|dp_y[i-1][j-v_y[i-1]];
            else dp_y[i][j]=dp_y[i-1][j+v_y[i-1]];
        }
    }
    if(dp_x[v_x.size()][x+s.length()]==true &&  dp_y[v_y.size()][y+s.length()]==true)cout << "Yes";
    else cout << "No";
}

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

using namespace std;
using ll = long long;

int main() {
    ll n, d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        if (sqrt(x*x + y*y) <= d) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>

using namespace std;

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

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

using namespace std;

typedef pair<int, int> P;

vector<P> G[30];

bool leaf[30];
bool used[30];

void search1(int index){
	
	used[index] = true;
	
	bool check = true;
	
	for(int i = 0; i < G[index].size(); i++){
		
		P p = G[index][i];
		
		if(!used[p.second]){
			check = false;
			search1(p.second);
		}
	}
	
	if(check){
		leaf[index] = true;
	}
	
}

int search2(int index){
	
	used[index] = true;
	
	int ret = 0;
	
	for(int i = 0; i < G[index].size(); i++){
		
		P p = G[index][i];
		
		if(!used[p.second] && !leaf[p.second]){
			ret += p.first * 2 + search2(p.second);
		}
	}
	
	return ret;
}

int search3(int index){
	
	used[index] = true;
	
	int ret = 0;
	
	for(int i = 0; i < G[index].size(); i++){
		
		P p = G[index][i];
		
		if(!used[p.second] && !leaf[p.second]){
			ret = max(p.first + search3(p.second), ret);
		}
	}
	
	return ret;
}

int main(){
	
	while(true){
		
		int N;
		
		cin >> N;
		
		if(N == 0){
			break;
		}
		
		for(int i = 0; i < 30; i++){
			G[i].erase(G[i].begin(), G[i].end());
		}
		
		for(int i = 0; i < N - 1; i++){
			int index1, index2, cost;
			cin >> index1 >> index2 >> cost;
			index1--;
			index2--;
			P e1, e2;
			e1.second = index2;
			e2.second = index1;
			e1.first = cost;
			e2.first = cost;
			G[index1].push_back(e1);
			G[index2].push_back(e2);
		}
		
		for(int i = 0; i < N; i++){
			leaf[i] = false;
			used[i] = false;
		}
		
		search1(0);
		
		for(int i = 0; i < N; i++){
			used[i] = false;
		}
		
		int sum = search2(0);
		
		for(int i = 0; i < N; i++){
			used[i] = false;
		}
		
		int max_l = search3(0);
		
		cout << sum - max_l << endl;
		
	}
	return 0;
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
typedef vector<ll> vll;

struct clue {
    int x;
    int y;
    int h;
};

int main() {
    int n;
    cin >> n;
    vector<clue> clues(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> clues[i].x >> clues[i].y >> clues[i].h;
        if (clues[i].h > 0) {
            clues[0] = clues[i];
        }
    }
    bool found = true;
    for (int ix = 0; ix <= 100; ++ix) {
        for (int iy = 0; iy <= 100; ++iy) {
            int ih = abs(clues[0].x - ix) + abs(clues[0].y - iy) + clues[0].h;
            for (int i = 1; i <= n; ++i) {
                if (max(ih - abs(clues[i].x - ix) - abs(clues[i].y - iy), 0) == clues[i].h) continue;
                else {
                    found = false;
                    break;
                }
            }
            if (found) {
                cout << ix << " " << iy << " " << ih << endl;
                return 0;
            }
            found = true;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;++i) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    for(int i=0;i<k;++i) {
        ans += a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;	
const int N=100005;
typedef long long int lint;

string a;
int b;


lint f1(string a)
{
	string t=a;
	a=a+a; 
	lint ans=0;
	for (int i = 0; i < a.size(); ++i)
		if(a[i]==a[i+1] && a[i]!=0)
		{
			ans++;
			a[i+1]=0;
		}
	if(a[a.size()-1]!=0) ans++;
	ans = ans*((b-1)/2);
	if(b%2)
	{
		a=t;
		for (int i = 0; i < a.size(); ++i)
		if(a[i]==a[i+1] && a[i]!=0)
		{
			ans++;
			a[i]=0;
			a[i+1]=0;
		}

	}
	else
	{
		a=t+t;
		for (int i = 0; i < a.size(); ++i)
		if(a[i]==a[i+1] && a[i]!=0)
		{
			ans++;
			a[i]=0;
			a[i+1]=0;
		}

	}

	return ans;
}
lint f2(string a)
{
	string t=a;
	a=a+a; 
	lint ans=0;
	for (int i = 0; i < a.size(); ++i)
		if(a[i]==a[i+1] && a[i]!=0)
		{
			ans++;
			if(i==0)
				a[i]=0;
			else
				a[i+1]=0;
		}
	if(a[0]!=0) ans++;
	ans = ans*(b/2);
	if(b%2)
	{
		a=a[a.size()-1] + t;
		for (int i = 0; i < a.size(); ++i)
		if(a[i]==a[i+1] && a[i]!=0)
		{
			ans++;
			a[i]=0;
			a[i+1]=0;
		}

	}
	return ans;
}
int main(){
	cin >> a >> b;
	if(a[0]!=a[a.size()-1])
	{
		lint ans=0;
		for (int i = 0; i < a.size(); ++i)
			if(a[i]==a[i+1] && a[i]!=0)
			{
				ans++;
				a[i]=0;
				a[i+1]=0;
			}
		ans = ans*b;
		cout << ans;
	}
	else
	{
		cout << min(f1(a),f2(a));		
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    string s, t;
    cin >> s >> t;
    int n = (int) s.size();
    int m = (int) t.size();

    int ans = m;
    int c;
    for (int i = 0; i <= n-m; i++){
        c = m;
        for (int k = 0; k < m; k++){
            if (t[k] == s[i+k]) c--;
        }
        ans = min(ans, c);
    }
    cout << ans << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    CIN(int, M);

    vector<vector<int>> s(M, vector<int> (N, -1));
    vector<int> K(M);

    for (int i = 0; i < M; i++) {
        int k;
        cin >> k;
        K[i] = k;
        for (int j = 0; j < k; j++) {
            int ss;
            cin >> ss;
            s[i][j] = ss - 1;
        }
    }
    CINS(int, p, M);

    int ans = 0;
    vector<int> joutai(N);
    bool check;

    for (int i = 0; i < pow(2, N); i++) {
        check = true;
        int temp = i;
        for (int j = 0; j < N; j++) {
            joutai[j] = temp % 2;
            temp /= 2;
        }
        for (int j = 0; j < M; j++) {
            int sum = 0;
            for (int k = 0; k < K[j]; k++) {
                sum += joutai[s[j][k]];
            }
            if ((sum-p[j])%2!=0) {
                check = false;
                break;
            }
        }
        if (check) ans++;
    }

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

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

using namespace std;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   int n;
   cin>>n;
   
   if(n%1000==0)
   cout<<0<<endl;
   else
   {
       int x = n/1000;
       
       cout<<(x+1)*(1000) - n<<endl;
   }
   
   return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}

int main(){
    ll n,d;cin>>n>>d;
    ll ans=0;
    rep(i,n){
        ll a,b;cin>>a>>b;
        if(a*a+b*b<=d*d) ans++;
    }

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

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
# define M_PI           3.14159265358979323846
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;int x;
	int a[n+1]={0};
	for(int i=0;i<n-1;i++)
		{
		cin>>x;
		a[x]++;}
	for(int i=1;i<=n;i++)
		cout<<a[i]<<endl;
}

Measured memory_bytes: 4436
#include <iostream>

using namespace std;

int main()
{
    char a , c , g , t ,b;
    a='A';
    c='C';
    g='G';
    t='T';
    cin>> b;
    if (b==a) {
        cout<< t;
    }
    if (b==t) {
        cout<< a;
    }
    if (b==g) {
        cout<< c;
    }
    if (b==c) {
        cout<< g;
    }

    return 0;
}


Measured memory_bytes: 3576
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long r, g, b, n;
    scan(r, g, b, n);
    long count;
    foreach (i; 0 .. n + 1)
    {
        foreach (j; 0 .. n + 1)
        {
            long difference = n - r * i - g * j;
            if(difference < 0)
            {
                break;
            }
            if(difference % b == 0)
            {
                count++;
            }
        }
    }
    writeln(count);
}

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

using namespace std;


int f(string s) {
    int ans = 0;
    int counter = 0;
    char cur = s[0];
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == cur) {
            counter++;
        } else {
            if(counter > 1) {
                if(counter % 2 == 0) {
                    ans += counter / 2;
                } else {
                    ans += (counter - 1) / 2;
                }
            }
            counter = 1;
            cur = s[i];
        }
    }
    if(counter > 1) {
        if(counter % 2 == 0) {
            ans += counter / 2;
        } else {
            ans += (counter - 1) / 2;
        }
    }
    return ans;
}

int main() {
    string s;
    int k;
    cin >> s >> k;
    if(s.size() == 1) {
        if(k % 2 == 0) {
            cout << k / 2 << "\n";
        } else {
            cout << (k - 1) / 2 << "\n";
        }
        return 0;
    }
    long long one = f(s);
    vector<int> alphabets(26, 0);
    for(int i = 0; i < s.size(); i++) {
        alphabets[s[i]-'a']++;
    }
    int cnt = 0;
    for(int i = 0; i < 26; i++) {
        if(alphabets[i] == 0) {
            cnt++;
        }
    }
    if(cnt == 25) {
        long long ans = k * s.size();
        if(ans % 2 == 0) {
            ans /= 2;
        } else {
            ans = (ans - 1) / 2;
        }
        cout << ans << "\n";
        return 0;
    }
    if(s[0] != s[s.size()-1]) {
        cout << one * k << "\n";
    } else {
        long long ans = one * k;
        long long a = 0, b = 0;
        char cur1 = s[0];
        for(int i = 0; i < s.size(); i++) {
            if(s[i] == cur1) {
                a++;
            } else {
                break;
            }
        }
        long long ha;
        if(a % 2 == 0) {
            ha = a / 2;
        } else {
            ha = (a - 1) / 2;
        }
        char cur2 = s[s.size()-1];
        for(int i = s.size()-1; i >= 0; i--) {
            if(s[i] == cur2) {
                b++;
            } else {
                break;
            }
        }
        long long hb;
        if(b % 2 == 0) {
            hb = b / 2;
        } else {
            hb = (b - 1) / 2;
        }
        ans -= ha * (k - 1);
        ans -= hb * (k - 1);
        long long hh;
        if((a + b) % 2 == 0) {
            hh = (a + b) / 2;
        } else {
            hh = (a + b - 1) / 2;
        }
        ans += hh * (k - 1);
        cout << ans << "\n";
    }
    return 0;
}

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

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


#define ll long long 
#define ld long double
#define pb push_back
#define F first
#define S second
#define I insert
#define pll pair<ll,ll> 
#define vll vector<ll> 
#define vpll vector< pll >

int main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll n,k,a,b,c,d,i,j;
	vll v;
	cin>>n>>k;a=0;b=0;ll ans=1e15;ll fina=1e15;
	for(i=0;i<n;i++){
		cin>>d;v.pb(d);
		b++;if(b<k)continue;
		if(b>k)a++,b--;ans=0;
		if(v[a]<0)ans+=abs(v[a]);if(v[i]>0)ans+=abs(v[i]);
		if((v[a]*v[i])<0)ans+=min(abs(v[a]),abs(v[i]));
		//trace(i,ans);
		fina=min(fina,ans);
	}
	cout<<fina;
	return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        double A = s.nextDouble();
        double B = s.nextDouble();
        double T = s.nextDouble();
        double tmp = Math.floor((T + 0.5)/A) * B;
        System.out.println((int)tmp);
        s.close();
    }
}

Measured memory_bytes: 24532
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
int a[50];
int used[50];
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	 string s;
	 cin>>s;
	 if(s=="zyxwvutsrqponmlkjihgfedcba") 
	 {
	 	cout<<-1;
	 	return 0;
	 }
	 for(int i=0;i<s.size();i++) a[i]=s[i]-'a',used[a[i]]++;
	 if(s.size()==26)
	 {
	 	for(int i=s.size()-1;i>=0;i--)
	 	{
	 		used[a[i]]=0;
	 		for(int j=0;j<26;j++)
	 		{
	 			if(j>a[i] and used[j]==0)
	 			{
	 				a[i]=j;for(int k=0;k<i+1;k++) cout<<char(a[k]+'a');return 0;
	 			}
	 		}
	 	}
	 }
	 else
	 {
	 	cout<<s;
	 	for(int i=0;i<26;i++)
	 	{
	 		if(used[i]==0)
	 		{
	 			cout<<char(i+'a');return 0;
	 		}
	 	}
	 }

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
  int a;
  cin>>a;
  if(a<1200){
    cout<<"ABC"<<endl;
  }else if(a<2800){
    cout<<"ARC"<<endl;
  }else{
    cout<<"AGC"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#マス i には ai が書かれています
#奇数番目に奇数が書かれている数

N = int(input())
l = input().rstrip().split(" ")
a = list(map(int, l))
#print(a)

ans = 0
for i in range(len(a)):
    if i % 2 == 1:  #奇数番目の番号は偶数なので
        continue
    else:
        if a[i] % 2 == 1:
            ans += 1
print(ans)

Measured memory_bytes: 9112
#include<stdio.h>
main(){
  int h,w,i,j;
  while(1){
    scanf("%d%d",&h,&w);
    if(h==0 && w==0)
      break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++)
	if(i%2==0)
	  if(j%2!=0)
	    printf(".");
	  else
	    printf("#");
	else
	  if(j%2==0)
	    printf(".");
	  else 
	    printf("#");
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572