akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut sc: Vec<(usize, u8)> = vec![];
    for _ in 0..m {
        sc.push((read(), read()));
    }

    for i in 0..10_i32.pow(n as u32) {
        let ss = format!("{}", i);
        if ss.len() != n {
            continue;
        }
        let ss: Vec<u8> = ss.as_bytes().to_vec().iter().map(|x| x - b'0').collect();
        if sc.iter().all(|&(s, c)| ss[s - 1] == c) {
            println!("{}", i);
            return;
        }
    }
    println!("-1");
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	cin.tie( 0 ); ios::sync_with_stdio( false );
	ull n,d;cin>>n>>d;
	vector<vector<ll>> v2( n, vector<ll>( d, 0 ) );
	REP(i,n)REP(j,d)
	{
		cin>>v2[i][j];
	}
	
	auto is = [&v2,&d](int a, int b)
	{
		int s = 0;
		REP( i,d )
		{
			int r = v2[a][i] - v2[b][i];
			s += r*r;
		}
		int t = sqrt(s);
		//cout << a<<b<<s << endl;
		return t * t == s;
	};
	
	int ans = 0;
	REP(i,n)REP(j,n)if(i<j)
	{
		ans += (is(i,j)?1:0);
	}
	cout << ans << endl;
	return 0;
}

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

int main(void){
int n;
string s;
int r,l;//0ならした
int t;//0なら下にいる
int i,j,k;
int ans=0;

while(true){
cin>>n;
if(n==0)return 0;
ans=0;
r=0;l=0;t=0;
for(i=0;i<n;i++){
	cin>>s;
	if(s=="lu"){
		l=1;
	}
	else if(s=="ru"){
		r=1;
	}
	else if(s=="ld"){
		l=0;
	}
	else if(s=="rd"){
		r=0;
	}
	if(t==0&&r==1&&l==1){t=1;ans+=1;}
	if(t==1&&r==0&&l==0){t=0;ans+=1;}	
}
cout<<ans<<endl;
}
return 0;
}



Measured memory_bytes: 3120
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int k;
    ll a = 1, d = 1;
    cin >> k;
    while (k--) {
        string s = to_string(a + d), t = to_string(a + d * 10);
        double m = 0, n = 0;
        for (char i : s) m += i - '0';
        for (char i : t) n += i - '0';
        double b = (a + d) / m, c = (a + d * 10) / n;
        cout << a << '\n';
        if (b < c + 1e-9) a += d;
        else d *= 10, a += d;
    }
}


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

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
 
const int mod=1000000007;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a);
        a%=mod;
        b>>=1;
    }
    return ans;
}


int32_t main()
{
    fast;
    int k,x;
    cin>>k>>x;

    repa(i,max(x-k+1,(int)-1000000),min(x+k-1,(int)1000000))
    cout<<i<<" ";
    cout<<endl;
    
    return 0;
}

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

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  cout << ((N) ? 0 : 1) << "\n";
}

Measured memory_bytes: 3636
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int numOfCases = scanner.nextInt();
        int[] array = new int[numOfCases];
        boolean isLeft = true;
        for (int i = 0; i < numOfCases; i++) {
            array[i] = scanner.nextInt();
        }
        int leftIndex = 0;
        int rightIndex = array.length - 1;
        int[] output = new int[numOfCases];
        for (int i = numOfCases - 1; i >= 0; i--) {
            if (isLeft) {
                output[leftIndex++] = array[i];
            }
            else {
                output[rightIndex--] = array[i];
            }
            isLeft = !isLeft;
        }
        for (int i = 0; i < output.length; i++) {
            System.out.print(output[i] + " ");
        }
    }
}

Measured memory_bytes: 92784
#include <iostream>

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++)
    {
        if (s[i] == t[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b, c, d, e, f, aw = 1, as = -1;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100, b *= 100;
    for (int i = 0; i * a <= f; ++i) for (int j = 0; i * a + j * b <= f; ++j) for (int k = 0; k * c <= (i * a + j * b) / 100 * e && i * a + j * b + k * c <= f; ++k) for (int l = 0; k * c + l * d <= (i * a + j * b) / 100 * e && i * a + j * b + k * c + l * d <= f; ++l) if (as / double(aw) < (k * c + l * d) / double(i * a + j * b + k * c + l * d)) aw = i * a + j * b + k * c + l * d, as = k * c + l * d;
    cout << aw << " " << as << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }

template<class T>
T pow(T x, ll n, T r = 1) {
    while (n) {
        if (n & 1) r *= x;
        x *= x;
        n >>= 1;
    }
    return r;
}

template<uint MD>
struct ModInt {
    uint v;
    ModInt() : v{0} {}
    ModInt(ll v) : v{normS(v%MD+MD)} {}
    static uint normS(const uint &x) {return (x<MD)?x:x-MD;};
    static ModInt make(const uint &x) {ModInt m; m.v = x; return m;}
    ModInt operator+(const ModInt &r) const {return make(normS(v+r.v));}
    ModInt operator-(const ModInt &r) const {return make(normS(v+MD-r.v));}
    ModInt operator*(const ModInt &r) const {return make((ull)v*r.v%MD);}
    ModInt& operator+=(const ModInt &r) {return *this=*this+r;}
    ModInt& operator-=(const ModInt &r) {return *this=*this-r;}
    ModInt& operator*=(const ModInt &r) {return *this=*this*r;}
    static ModInt inv(const ModInt &x) {
        return pow(ModInt(x), MD-2);
    }
};
using Mint = ModInt<TEN(9)+7>;

using T = tuple<int, int, int, int, int>;
map<T, Mint> dp;
int n;
Mint calc(int p, int a, int b, int c, int f) {
    if (p == 2*n) {
        if (f == 0) return 1;
        return 0;
    }
    T key = T(p, a, b, c, f);
    if (dp.count(key)) {
        return dp[key];
    }
    // non use
    Mint ans = 0;
    if ((f & 4) == 0) {
        ans += calc(p+1, a, b, c, (f<<1)+1);
    }
    // back single
    if (a && (f & 1)) {
        ans += calc(p+1, a-1, b, c, (f^1)<<1);
    }
    if (b && (f & 2)) {
        ans += calc(p+1, a, b-1, c, (f^2)<<1);
    }
    if (c && (f & 4)) {
        ans += calc(p+1, a, b, c-1, (f^4)<<1);
    }
    return dp[key] = ans;
}


Mint fact[100000], iFac[100000];
Mint C(int n, int k) {
    return fact[n]*iFac[k]*iFac[n-k];
}
int main() {
    fact[0] = 1;
    for (int i = 1; i < 100000; i++) {
        fact[i] = fact[i-1]*i;
    }
    for (int i = 0; i < 100000; i++) {
        iFac[i] = Mint::inv(fact[i]);
    }

    ios::sync_with_stdio(0);
    cout << setprecision(20);
    cin >> n;
    int a, b, c;
    cin >> a >> b >> c;
    Mint ans = 0;
    for (int x = 0; x <= c; x++) {
        for (int y = 0; y <= c; y++) {
            int z = a-y;
            if (z < 0) continue;
            int nb = b;
            int nc = c-3*x-y;
            if (nc < 0) continue;
            if (nb % 2) continue;
            int w = nb/2;
            Mint base = 1;
            base *= C(x+y+z+w, x);
            base *= C(y+z+w, y);
            base *= C(z+w, z);
            int cu = nc;
            if (cu && w == 0) continue;
            if (cu > 0) {
                base *= C(cu+w-1, cu);
            }
            ans += base;
        }
    }
    cout << ans.v << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    string S, T;
    cin >> N >> S >> T;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        bool flag = true;
        for(int j = 0; j < N; j++) {
            if(i + j >= N) break;
            if(S[i + j] != T[j]) flag = false;
        }
        if(flag) {
            ans = max(ans, N - i);
        }
    }
    cout << 2 * N - ans << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < N; i++){
    cout << S.at(i);
    cout << T.at(i);
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b, c, tmp;

    scanf("%d %d %d", &a, &b, &c);
    do {
        if(a > b) {
            tmp = b;
            b = a;
            a = tmp;
        }
        if(b > c) {
            tmp = c;
            c = b;
            b = tmp;
        }
    } while (a > b || b > c);

    printf("%d %d %d\n", a, b, c);

    return 0;

}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  string A,B,C;
  cin>>A>>B>>C;
  int ans=0;
  REP(i,N){
    if(A[i]==B[i] and B[i]==C[i]){
      continue;
    }else if(A[i]==B[i] or B[i]==C[i] or C[i]==A[i]){
      ans++;
    }else{
      ans+=2;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int N;
vector<long> value;
vector<long> delay;
long MONO = -1e16;

void update(int i, long x){
  i += N-1;
  value.at(i) = x;
  while(i > 0){
    i = (i-1)/2;
    long c1 = value.at(i*2 + 1);
    long c2 = value.at(i*2 + 2);
    value.at(i) = max(c1, c2); //min max 切り替え可能
  }
}

void eval(int k, int l, int r){
  if(delay.at(k) != 0){
    value.at(k) += delay.at(k);
    if(r - l > 1){
      delay.at(2*k+1) = delay.at(k)/2;
      delay.at(2*k+2) = delay.at(k)/2;
    }
    delay.at(k) = 0;
  }
}

void add_range(int a, int b, int k, int l, int r, long x){
  eval(k, l, r);
  if(r <= a || b <= l) return;
  if(a <= l && r <= b){
    delay.at(k) += (r - l) * x;
    eval(k, l, r);
  }else{
    add_range(a, b, 2*k+1, l, (l+r)/2, x);
    add_range(a, b, 2*k+1, (l+r)/2, r, x);
    value.at(k) = value.at(2*k+1) + value.at(2*k+2);
  }
}

long query(int a, int b, int k, int l, int r){ //[a,b)が知りたい区間 [l,r)は初め0,N代入 k=0 現ノード
  if(r <= a || b <= l) return MONO;
  eval(k, l, r);
  if(a <= l && r <= b) return value.at(k);
  else{
    long c1 = query(a, b, 2*k+1, l, (l+r)/2);
    long c2 = query(a, b, 2*k+2, (l+r)/2, r);
    return max(c1, c2); //min max 切り替え可能
  }
}

int main(){
  long h,w,m;
  cin >> h >> w >> m;
  N = 1;
  while (N < w) N *= 2; // 葉の数を計算（n以上の最小の2冪数）
  vl x(m),y(m);
  vl cx(h,0),cy(w,0);
  vvl data(h);
  rep(i,m){
    cin >> x.at(i) >> y.at(i);
    x.at(i)--;y.at(i)--;
    cx.at(x.at(i))++;
    cy.at(y.at(i))++;
    data.at(x.at(i)).push_back(y.at(i));
  }
  value = vector<long>(2 * N - 1, MONO);
  delay = vector<long>(2 * N - 1, 0);
  rep(i,w){
    update(i,cy.at(i));
  }
  long ans = 0;
  rep(i,h){
    long p = cx.at(i);
    for(long v : data.at(i)){
      update(v, cy.at(v)-1);
    }
    long q = value.at(0);
    ans = max(ans, p+q);
    for(long v : data.at(i)){
      update(v, cy.at(v));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 45500
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}

ll const mod =1e9+7;
int main() {
  ll N,K,a,b;
  cin >> N >> K;
  map<int,ll> mp;
  rep(i,N) {
    cin >> a >> b;
    mp[a];
    mp[a]+=b;
  }
  ll cnt=0;
  for (auto ix=mp.begin();ix!=mp.end();ix++){
    cnt+=ix->second;
    if (cnt>=K) {
      cout << ix->first << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>

using namespace std;

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

    string s, t;
    cin >> s;
    cin >> t;

    int slen = s.length(), tlen = t.length();
    s = t + '#' + s;
    for (int i = 0; i < t.length(); i++) {
        s += s[tlen+1+i%s.length()];
    }

    int z[s.length()];
    z[0] = 0;
    int j0 = 0, j1 = 0;
    for (int i = 1; i < s.length(); i++) {
        if (i >= j1) {
            j0 = j1 = i;
        }
        if (i + z[i-j0] < j1) {
            z[i] = z[i-j0];
        } else {
            j0 = i;
            while (j1 < s.length() && s[j1] == s[j1-j0]) {
                j1++;
            }
            z[i] = j1 - j0;
        }
    }

    bool v[slen];
    memset(v, false, sizeof(v));
    int ans = 0;
    for (int i = 0; i < slen; i++) {
        if (!v[i] && z[tlen+1+i] == tlen) {
            int x = i;
            int cnt = 0;
            while (!v[x] && z[tlen+1+x] == tlen) {
                v[x] = true;
                cnt++;
                x = ((x - tlen) % slen + slen) % slen;
            }
            if (v[x]) {
                cout << -1 << endl;
                return 0;
            }

            x = (i + tlen) % slen;
            while (!v[x] && z[tlen+1+x] == tlen) {
                v[x] = true;
                cnt++;
                x = (x + tlen) % slen;
            }

            ans = max(ans, cnt);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9180
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<iostream>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  ll n;
  cin >> n;
  ll ans=n-1;
  for(int i=1;i<1000001;i++){
    if(n%i==0) {
      ll a=n/i;
    ans=min(ans,i+a-2);
    }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
int judge(int n){
 return n%2;
}
int main(){
 int n;
 scanf("%d",&n);
 int cnt = 0;
 for(int i=0;i<n;i++){
  int t;
  scanf("%d",&t);
  if(judge(i+1)&&judge(t)){
   cnt++;
  }
 }
 printf("%d",cnt);
}


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

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

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

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	map<string, int> mapp;
	for(int i = 0; i < n; i++)
	{
		string s; cin >> s;
		mapp[s]++;
	}
	cout << "AC x " << mapp["AC"] << endl;
	cout << "WA x " << mapp["WA"] << endl;
	cout << "TLE x " << mapp["TLE"] << endl;
	cout << "RE x " << mapp["RE"] << endl;

	return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <string>
using namespace std;

#define A 0
#define B 1
#define AB 2
#define O 3

int main(){
	string in;
	int abo[4] = {};

	while (cin >> in, !cin.eof()){
		int commaPlace = in.find(',');
		if (in[commaPlace + 1] == 'A'){
			if (commaPlace + 2 == in.length()){
				abo[A]++;
			}
			else{
				abo[AB]++;
			}
		}
		else if (in[commaPlace + 1] == 'B'){
			abo[B]++;
		}
		else{
			abo[O]++;
		}
	}
	for (int i = 0; i < 4; i++){
		cout << abo[i] << endl;
	}

	return 0;
}

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



int main()
{
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for(int i = 0; i < n; i++)std::cin >> a[i];
    int nokoru = 0,cur = 0;
    for(int i = 0; i < n; i++){
        if(a[i] == cur + 1){
            cur++;
            nokoru++;
        }
    }
    std::cout << (nokoru==0 ? -1 : n - nokoru) << std::endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a[51];
bool cmp(int a,int b)
{return a>b;
}
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1,cmp);
	long long tot=0;
	for(int i=1;i<=k;i++)tot+=a[i];
	cout<<tot;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int ary[510][510];

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

	if(k == 1){
		puts("1");
		puts("1");
		return 0;
	}

	const int n = 2 * ((k + 3) / 4);
	int cur = 2 * n;

	rep(i, n) rep(j, n){
		const int val = (i + j) % n;
		ary[i][j] = val;
		if(i % 2 == 1) ary[i][j] += n;
	}

	int from = n + n - 1, to = n - 1;
	while(cur > k){
		rep(i, n) rep(j, n){
			if(ary[i][j] == from){
				ary[i][j] = to;
			}
		}
		from--, to--, cur--;
	}

	cout << n << endl;
	rep(i, n){
		rep(j, n) cout << (j ? " " :"") << ary[i][j] + 1;
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    cout<<n*n*n<<endl;    
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    string res = "";
    while(true){
        
        c -= b;
        if(c<=0){
            res = "Yes";
            break;
        }
        a -= d;
        if (a <= 0)
        {
            res = "No";
            break;
        }
    }
    c(res);
}


Measured memory_bytes: 3584
/*
    Author: Mohammad faisal
    Problem: AtCoder Beginner Contest 111.
    Date: 07/08/2019

*/
// #include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
using namespace std;
// long long gcd(long long a,long long b)
// {
//   if(b)
//     return gcd(b,a%b);
//   else
//     return a;
// }
int main()
{
  int n;
  cin >> n;
  if(n<=111)
    cout<<111;
  else if(n>111 && n<=222)
    cout<<222;
  else if(n>222 && n<=333)
    cout<<333;
  else if(n>333 && n<=444)
    cout<<444;
  else if(n>444 && n<=555)
    cout<<555;
  else if(n>555 && n<=666)
    cout<<666;
  else if(n>666 && n<=777)
    cout<<777;
  else if(n>777 && n<=888)
    cout<<888;
  else if(n>888 && n<=999)
    cout<<999;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  vector<int> x(N),y(M);
  int x_max=X;
  int y_min=Y;
  for(int i=0;i<N;i++){
    cin>>x.at(i);
    if(x.at(i)>x_max){
      x_max=x.at(i);
    }
  }
  for(int j=0;j<M;j++){
    cin>>y.at(j);
    if(y.at(j)<y_min){
      y_min=y.at(j);
    }
  }
  if(x_max<y_min) cout<<"No War"<<endl;
  else cout<<"War"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
int main (void) {
  string strIn;
  int Tcnt = 0;
  string::size_type idx;
 
  cin >> strIn;
 
  for(int i = 0; i < 75; i++) {
    idx = strIn.find("K");
    if(idx == string::npos) break;
    strIn = strIn.substr(0, idx) + strIn.substr(idx+1);
     
     
    idx = strIn.find("U");
    if(idx == string::npos) break;
    strIn = strIn.substr(0, idx) + strIn.substr(idx+1);
 
    idx = strIn.find("P");
    if(idx == string::npos) break;
    strIn = strIn.substr(0, idx) + strIn.substr(idx+1);
 
    idx = strIn.find("C");
    if(idx == string::npos) break;
    strIn = strIn.substr(0, idx) + strIn.substr(idx+1);
 
    Tcnt++;
  }
 
  cout << Tcnt << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<" ";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll ans=0;
    vector<ll> number(1000,0);

    rep(i,1000){
        if (number[i] != 1){
            string str = to_string(i);
            if(i<100){
                //0埋め
                std::ostringstream oss;
                oss.setf(std::ios::right); //右詰め
                oss.fill('0');
                oss.width(3);
                oss << i;
                str = oss.str();
            }
            ll flg = 0;
            ll cnt = 0;
            for(ll j=0; j<n-2; j++) {
                cnt++;
                if(s[j]==str[0]) {
                    flg++;
                    break;
                }
            }
            for(ll j=cnt; j<n-1; j++) {
                cnt++;
                if(s[j]==str[1]) {
                    flg++;
                    break;
                }
            }
            for(ll j=cnt; j<n; j++) {
                cnt++;
                if(s[j]==str[2]) {
                    flg++;
                    break;
                }
            }
            if (flg == 3) {
                number[i] = 1;
            }
        }
    }
    ans = count(number.begin(), number.end(), 1);
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define sz size()
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 2*100005
#define se second
#define fi first
#define be begin()
#define en end()
#define sortv(v) sort(v.begin(),v.end());
#define w() ll _;cin>>_;while(_--)
#define edge pair<ll,ll>
#define pq priority_queue<ll>
#define mod 1000000007
#define Endl "\n"
#define cy cout<<"YES"<<endl;
#define cn cout<<"NO"<<endl;
using namespace std;
	map<ll,ll>m;
int main()
{
	fast;
	ll n;
	cin>>n;
	ll a[n];

	ll i;
	ll sum=0;
	rep(i,n)
	{
		cin>>a[i];
		m[a[i]]++;
		sum+=a[i];
	}
	ll q;
	cin>>q;
	while(q--)
	{
		ll s=0;
		ll b,c;
		cin>>b>>c;
		sum=sum-m[b]*b+c*m[b];
		cout<<sum<<endl;
		m[c]=m[c]+m[b];
		m[b]=0;
		
	}

	return 0;
	
}

Measured memory_bytes: 10272
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	int maxMOD = 1;
	if(n == 1){
		cout << m << endl;
		return 0;
	}
	for(int mod = 2; mod <= m ; mod++){
		int x = m - mod * (n-1);
		if( x >= mod){
			if(x % mod == 0) maxMOD = mod;
		}else break;
	}
	printf("%d\n",maxMOD);
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

int main() {
	int n, m;
	cin >> n >> m;
	vi dist(n+1);
	FOR(i, 2, n) {
		cin >> dist[i];
		dist[i] += dist[i - 1];
	}

	int s, p = 1, ans = 0;
	REP(i, m) {
		cin >> s;
		int np = p + s;
		ans += abs(dist[p] - dist[np]);
		ans %= 100000;
		p = np;
	}
	cout << ans << endl;
	return 0;
}

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

template <typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

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

    long long N;
    cin >> N;
    long long res = 1;
    for (long long i = 0; i < N; i++) {
        long long tmp;
        cin >> tmp;
        res = lcm(res, tmp);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;
int H;
void input() {
  cin >> H >> N;
  va.resize(N);
  rep(i, 0, N - 1) { cin >> va[i]; };
  ;
}
void solve() {
  int k = 0;
  for (auto x : va) {
    k += x;
  }
  if (H <= k) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  };
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

typedef struct {
	double x;
	double y;
} Point;

void koch(int n, Point p1, Point p2) {

	if (n == 0) return;

	Point s, t, u;

	s.x = ((2 * p1.x) + (1 * p2.x)) / 3;
	s.y = ((2 * p1.y) + (1 * p2.y)) / 3;
	t.x = ((1 * p1.x) + (2 * p2.x)) / 3;
	t.y = ((1 * p1.y) + (2 * p2.y)) / 3;
	u.x = (t.x - s.x)*cos(M_PI / 3) - (t.y - s.y)*sin(M_PI / 3) + s.x;
	u.y = (t.x - s.x)*sin(M_PI / 3) + (t.y - s.y)*cos(M_PI / 3) + s.y;

	koch(n - 1, p1, s);
	printf("%.8f %.8f\n", s.x, s.y);

	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);

	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);

	koch(n - 1, t, p2);
}

int main() {
	int n;
	Point a = { 0,0 };
	Point b = { 100,0 };

	scanf("%d", &n);

	printf("%.8f %.8f\n", a.x, a.y);

	koch(n, a, b);

	printf("%.8f %.8f\n", b.x, b.y);

	return 0;

}


Measured memory_bytes: 2052
#include<iostream>
using namespace std;
int main(void)
{
    int money;
    int happy = 0;
    cin >> money;
    
    happy = (money / 500) * 1000;
    money %= 500;
    happy += (money / 5) * 5;
    
    cout << happy << endl;
  
    return 0;
}

Measured memory_bytes: 256
#include "stdio.h"
int main(int argc, char const *argv[])
{
	int a,b;
	scanf("%d %d",&a,&b);
	int c[a];
	for (int i = 0; i < a; ++i)
	{
		scanf("%d",&c[i]);
	}
	int count=0;
	int flag=0;
	for (int i = 0; i < a; ++i)
	{
		count=count+c[i];
		if (count>b)
		{
			flag=1;
			printf("%d\n",i+1);
			break;
		}
	}
	if (flag==0)
	{
		printf("%d\n",a+1);
	}
	return 0;
}

Measured memory_bytes: 128
import itertools
N,M,Q = map(int,input().split())
abcd = [list(map(int,input().split())) for _ in range(Q)]

def func(A):
    res = 0
    for i in range(Q):
        a,b,c,d = abcd[i]
        a -= 1
        b -= 1
        if A[b]-A[a]==c:
            res += d
    return res

ans = 0
for A in itertools.combinations_with_replacement([i+1 for i in range(M)],N):
    A = list(A)
    A.sort()
    ans = max(ans,func(A))

print(ans)

Measured memory_bytes: 80220
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
            int N = Input.ScanInt();
          int res = N*800 - (N/15)*200;
          Console.WriteLine(res);
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11092
#define rep(i,x) for (int i = 0; i < x; i++)
#define mod 1000000007
#define MOD 998244353
#define inf 1e18
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;


int main(){
	int n;
	cin >> n;
	vector<ll> x(n), y(n),t(n),u(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
		t[i] = x[i] + y[i];
		u[i] = x[i] - y[i];
	}
	rep(i, n - 1) {
		if ((t[i + 1]+10000000000) % 2 != (t[i]+10000000000) % 2) {
			cout << -1 << endl;
			return 0;
		}
	}
	string drc = "LRDU";
	int m = 31 + (!((t[0]+10000000000)%2));
	cout << m << endl;
	if (m == 32) cout << 1; 
	rep(i, 31) {
		cout <<" "<< (ll)pow(2, i);
	}
	cout << endl;
	if (m == 32) {
		rep(i, n) {
			t[i]++; u[i]++;
		}
	}
	//m==32のとき最初にLを出力する
	rep(i, n) {
		t[i] += (pow(2, 31) - 1);
		t[i] >> 1;
		u[i] += (pow(2, 31) - 1);
		u[i] >> 1;
		if (m == 32) cout << 'L';
		rep(j, 31) {
			if ((t[i] >> (j+1)) & 1) {
				if ((u[i] >> (j+1)) & 1) {
					cout << 'R';
				}
				else {
					cout << 'U';
				}
			}
			else {
				if ((u[i] >> (j+1)) & 1) {
					cout << 'D';
				}
				else {
					cout << 'L';
				}
			}
		}
		cout << endl;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp



ll d;
vector<ll> c(26);
vector<vector<ll>> vec(d, vector<ll>(26));

ll calc(vector<ll> t){
    ll res = 0;
    vector<ll> last(26);
    rep(i, d){
        rep(j, 26){
            if(t[i] == j){
                res += vec[i][j];
                last[j] = 0;
            }else{
                last[j]++;
            }
        }
        rep(j, 26){
            res -= c[j]*last[j];
        }
        //cout << res << endl;
    }
    return res;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    std::cout << std::fixed << std::setprecision(15);
    cin >> d;
    rep(i, 26){
        cin >> c[i];
    }
    vec.resize(d, vector<ll>(26));
    rep(i, d){
        rep(j, 26){
            cin >> vec[i][j];
        }
    }
    vector<ll> t(d);
    rep(i, d){
        cin >> t[i];
        t[i]--;
    }


    ll m; cin >> m;
    rep(i, m){
        ll dd, qq; cin >> dd >> qq;
        dd--; qq--;
        t[dd] = qq;
        ll res;
        res = calc(t);
        cout << res << endl;
    }


    /*
    ll ans = 0;
    ll tmp;
    tmp = calc(t);
    ans = max(ans, tmp);
    cout << tmp << endl;
    */




}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s,t; 
    cin >> s >> t;
    int n=s.size(), m=t.size();
    int ans=100000;
    rep(i,n-m+1){
        int res=0;
        bool ok=true;
        rep(j,m){
            if(s[i+j]==t[j]) continue;
            else{
                ++res;
            }
        }
        ans=min(ans,res);
    }
    cout << ans << "\n";
    return 0;
}   

Measured memory_bytes: 3656
#include <stdio.h>
#include <math.h>
int main()
{
	int n,d,r;
  double x,y;
  int res=0;
  scanf("%d %d",&n,&d);
  for(int i=0;i<n;i++)
  {
  scanf("%lf %lf",&x,&y);
   if(d<x||d<y) {}
   else if(sqrt(x*x+y*y)<=d) res++;
  }
  

  printf("%d",res);
  return 0;
}


Measured memory_bytes: 2196
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
#define repi(i, n, iv) for (int i = iv; i < n; i++)
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

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

    char c;
    cin >> c;

    cout << (0x41 <= c && c <= 0x5a ? "A" : "a") << endl;
}


Measured memory_bytes: 3048
import java.io.*;
public class Main
{
	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int d = (int)a / b;
		int r = a % b;
		double f = (double)a / b;
		System.out.printf("%d %d %.6f", d, r, f);
	}
}

Measured memory_bytes: 24876
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep (i, N) cin >> A[i];
  ll current = 0;
  for (auto it: A) {
    if (it == current + 1) current ++;
  }
  ll ans = N - current;
  if (current == 0) ans = -1;
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 1792
/**
 *    author        : Saurav-Paul 
 *    created       : September 19, 2020 6:00 PM
 *    Problem Name  : A - Plural Form
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc179/tasks/abc179_a
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
using namespace std;

using ll = long long int ;

class TC{

    public :
    void solve(){
        string s ;
        cin >> s;
        int sz = s.size() ;
        if(s[sz-1] == 's'){
            s += "es" ;
        }
        else{
            s += "s" ;
        }
        cout << s << endl ;

    }
};

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

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        TC tc;
        tc.solve() ;
    }

    return 0 ;
}


Measured memory_bytes: 3652
H, W = map(int, input().split())
S = [[s for s in input()] for _ in range(H)]

ans = []
for s in S:
    ans.append([0 if c == '.' else 1 for c in s])

# horizontal
for i, s in enumerate(S):
    for j in range(0, W - 1):
        if (s[j] == '#') and (s[j + 1] == '#'):
            ans[i][j] = 0
            ans[i][j + 1] = 0

# vertical
S = [list(x) for x in zip(*S)]
ans = [list(x) for x in zip(*ans)]
for i, s in enumerate(S):
    for j in range(0, H - 1):
        if (s[j] == '#') and (s[j + 1] == '#'):
            ans[i][j] = 0
            ans[i][j + 1] = 0

if sum([sum(x) for x in ans]):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  string s;
  cin >> s;
  int sum = 0;
  for(int i = 1; i < s.size(); i++){
    if(s[i - 1] != s[i]) sum++;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#define M 100000000
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,t,l,m,r[110],d[110][110],i,j,k,min,f[110],c[110],mi;
  while(scanf("%d %d %d %d %d %d",&n,&t,&l,&m,&r[0],&r[1]),n){
    for(i=0;i<10000;i++)d[i/100][i%100]=M;
    for(i=0;i<100;i++)d[i][i]=f[i]=0;
    for(i=0;i<100;i++)c[i]=M;
    l+=2;
    for(i=2;i<l;i++)scanf("%d",&r[i]);
    while(m--){
      scanf("%d %d %d",&i,&j,&k);
      d[i][j]=d[j][i]=k;
    }
    for(k=0;k<n;k++){
      for(i=0;i<n;i++){
	for(j=0;j<n;j++)d[i][j]=MIN(d[i][j],d[i][k]+d[k][j]);
      }
    }
    for(c[r[0]]=i=0;i<l;i++){
      min=M;
      for(j=0;j<l;j++){
	if(f[r[j]])continue;
	if(min>c[r[j]])min=c[mi=r[j]];
      }
      f[mi]=1;
      for(j=0;j<l;j++){
	if(d[mi][r[j]]>t)continue;
	c[r[j]]=MIN(c[r[j]],c[mi]+d[mi][r[j]]);
      }
    }
    if(c[r[1]]-M){
      if(c[r[1]]>t)c[r[1]]+=c[r[1]]-t;
      printf("%d\n",c[r[1]]);
    }
    else printf("Help!\n");
  }
  return 0;
}

Measured memory_bytes: 660
import sys
BASE, MOD = 80408696819889532, (1<<61)-1

class RollingHash():
	def __init__(self, s, base, mod):
		self.mod = mod
		self.pw = pw = [1]*(len(s)+1)

		l = len(s)
		self.h = h = [0]*(l+1)

		v = 0
		for i in range(l):
			h[i+1] = v = (v * base + s[i]) % mod
		v = 1
		for i in range(l):
			pw[i+1] = v = v * base % mod

	# [l. r)
	def get(self, l, r):
		return (self.h[r] - self.h[l] * self.pw[r-l]) % self.mod

	def concatenate(self, l1, r1, l2, r2):
		return (self.get(l1, r1) * self.pw[r2-l2] + self.get(l2, r2)) % self.mod


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if n == 1:
	print(0, a[0]^b[0])
	sys.exit()
x = [a[n-1]^a[0]]
y = [b[n-1]^b[0]]
for i in range(n-1):
	x.append(a[i]^a[i+1])
	y.append(b[i]^b[i+1])

rh_x, rh_y = RollingHash(x, BASE, MOD), RollingHash(y, BASE, MOD)
for k in range(n):
	if rh_y.concatenate(n-k, n, 0, n-k) == rh_x.get(0, n):
		print(k, a[0]^b[(n-k)%n])

Measured memory_bytes: 136296
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int64_t *a1, int64_t *a2) {
  scanf("%lld %lld", a1, a2);
  return 0;
}

#define BIT_MAX 40
int64_t func(int64_t num) {
    int bit;
    int64_t power = 1;
    int64_t ans = (num/2)%2;
    for(bit = 1; bit <= BIT_MAX; bit++) {
        // update
        power *= 2;
        int64_t order = num % (power*2);
        if(order <= power) continue; // if 0
        if(order%2) ans |= power; // if order=odd
    }
    return ans;
}

int main(void) {
    int64_t start, end;
    get_int2(&start, &end);
    // func([0, end+1)) - func([0, start))
    int64_t ans = func(end+1);
    ans = (ans ^ func(start));
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		double A = double.Parse(str[0]);
		double B = double.Parse(str[1]);
		double H = double.Parse(str[2]);
		double M = double.Parse(str[3]);
		double d1 = Math.Cos(Math.PI*(H*60+M)/360);
		double d2 = Math.Sin(Math.PI*(H*60+M)/360);
		double e1 = Math.Cos(Math.PI*(M)/30);
		double e2 = Math.Sin(Math.PI*(M)/30);
		double ans = Math.Pow((A*d1-B*e1)*(A*d1-B*e1)+(A*d2-B*e2)*(A*d2-B*e2),0.5);
		Console.Error.Write(d1+" "+d2+" "+e1+" "+e2);
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 19220
#include <bits/stdc++.h>
#define int long long int
#define gif(a,b) (a/b +(a%b?1:0))
#define pi 3.14159265358
#define watch(x) cout<<(#x)<<" is "<<(x)<<"\n";
using namespace std;

int32_t main()
{   
    cin.tie(NULL);
    std::ios::sync_with_stdio(false);
   
   float r;
   cin >> r;
   float ans = 2*pi*r;
   cout << ans;
    return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int x;
    for(int i = 1; i <= 100000; i++) {
        cin >> x;
        if(x == 0) {
            return 0;
        } else {
            cout << "Case " << i <<": " << x << endl;
        }
    }
    
}


Measured memory_bytes: 3016
n = int(input())
a= [0]*n
b= [0]*n

for i in range(n):
    a[i], b[i] = map(int, input().split())

if n%2 ==1:
    a.sort()
    b.sort()
    xmin= a[int((n-1)/2)]
    xmax= b[int((n - 1) / 2)]

    print(int(xmax-xmin+1))

if n%2 ==0:
    a.sort()
    b.sort()
    xmin = a[int(n/2-1)]+a[int(n/2)]
    xmax = b[int(n / 2 - 1)] + b[int(n / 2)]
    print(int((xmax-xmin)+1))

Measured memory_bytes: 82088