akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

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

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int k, x; cin >> k >> x;
		cout << (500 * k >= x ? "Yes" : "No") << endl;
    return;
}

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



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    ll x;
    cin >> x;
    ll i = 100,ans = 0;
    while(i < x)
    {
        i *= 1.01;
        ans++;
    }
    cout << ans << "\n";
    
    return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    ll ans = 0;
    int i;
    
    sort(h.rbegin(), h.rend());
    if(k < n){
        for(i=k;i<n;i++){

            ans = ans + h[i];
        }
    }

    cout << ans << endl;

    return 0;
}

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


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

	
	//順列生成なんてライブラリがあるんですね版
	int N, M, R;
	cin >> N >> M >> R;
	int r[8];
	rep(i, R) cin >> r[i];
	sort(r, r + R);

	int D[201][201];
	rep1(i, 200) {
		rep1(ii, 200) {
			D[i][ii] = 30000000;
		}
	}

	rep(i, M) {
		int A, B, C;
		cin >> A >> B >> C;
		D[A][B] = C;
		D[B][A] = C;
	}

	rep1(k, N) {
		rep1(i, N) {
			rep1(j, N) {
				if (D[i][j] > D[i][k] + D[k][j]) D[i][j] = D[i][k] + D[k][j];
			}
		}
	}

	int kumiawase = 1;
	rep1(i, R) kumiawase *= i;

	int saishou = 1e9;
	rep(i, kumiawase) {
		int goukei = 0;
		rep(i, R - 1) goukei += D[r[i]][r[i + 1]];
		saishou = min(saishou, goukei);

		next_permutation(r, r + R);
	}

	co(saishou);

	Would you please return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;
ll fac[200005];
ll rfac[200005];


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


int main() {
  ll n,k;
  cin >> n >> k;

  fac[0] = rfac[0] = 1;
  
  for(ll i = 1; i <= n; i++) {
    fac[i] = fac[i-1] * i % mod;
    rfac[i] = f(fac[i],mod-2);
  }

  ll ans = 1;
  for(ll i = 1; i <= min((ll)(n-1),k); i++) {
    ans = (ans + fac[n] * rfac[i] % mod * rfac[n-i] % mod * fac[n-1] % mod *  rfac[n-i-1] % mod * rfac[i] % mod) % mod;
  }
  cout << ans << endl;
}



  
  


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

int main() {
  std::string s;
  std::cin >> s;
  uint64_t k;
  std::cin >> k;

  for (uint64_t i = 0; i < k; i++) {
    if (s[i] != '1') {
      std::cout << s[i] << std::endl;
      return 0;
    }
  }
  std::cout << 1 << std::endl;
  return 0;
}


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

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> weight(N);
    vector<int> value(N);
    rep(i, N) cin >> weight[i] >> value[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(W + 1));

    rep(n, N + 1) rep(w, W + 1) {
        if (n == 0) {
            dp[n][w] = 0;
            continue;
        }

        int wei = weight[n - 1];
        int val = value[n - 1];
        if (w - wei >= 0) {
            dp[n][w] =
                max({dp[n - 1][w], (ll)dp[n - 1][w - wei] + val, dp[n][w - 1]});
        } else {
          dp[n][w] = max(dp[n-1][w],(w == 0 ? 0 : dp[n][w-1]));
        }
    }

    cout << dp[N][W] << endl;
}

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

int main() {
  int N,M,C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for(int i = 0;i < M;i++) {
    cin >> B.at(i);
  }
  int count = 0;
  for(int i = 0;i < N;i++) {
    vector<int> A(M);
    for(int j = 0;j < M;j++) {
      cin >> A.at(j);
    }
    int answer = 0;
    for(int j = 0;j < M;j++) {
      answer += B.at(j) * A.at(j);
    }
    answer = answer + C;
    if(answer > 0) {
      count++;
    }
  }
  cout << count << endl;
}
    

Measured memory_bytes: 256
n=int(input())

if n==0:
    print(0)
    exit(0)

pos=[0]*50
neg=[0]*50

def rec(x):
    if x>0:
        m=1
        while 4**m-1<3*x:
            m+=1
        
        pos[m-1]=1
        rec(x-4**(m-1))
    elif x<0:
        m=1
        while -2*(4**m-1)>3*x:
            m+=1
        
        neg[m-1]=1
        rec(x+2*(4**(m-1)))
    else:
        return

rec(n)

s=''
for i in range(100):
    if i%2==0:
        s=str(pos[i//2])+s
    else:
        s=str(neg[(i-1)//2])+s

i=0
while s[i]=='0':
    i+=1

print(s[i:])


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

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

  for(int a = 1;a<=9;a++){
    for(int b = 1; b<=9;b++){
      if(n==a*b){
	cout << "Yes" << endl;
	return 0;
      }
    }
  }

  cout << "No" << endl;
  
  return 0;
}


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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

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

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

int32_t main()
{
    FASTIO;

    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll ans = a[0];
    for(int i = 1, j = 2, cnt = 0; j<n; j++){
        if(cnt == 2) cnt = 0, i++;
        ans += a[i];
        cnt++;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 4780
import math

#関数gcd(a,b):最大公約数を求め、返す。a>b(どちらも整数）が前提
def gcd(a,b):
   if a%b==0:
       return b
   else:
        return gcd(b,a%b)

#A,B:与えられる正整数
A,B=map(int,input().split())

#MD:AとBの最大公約数
if A>=B:
    MD=gcd(A,B)
else:
    MD=gcd(B,A)

#count:求める個数（「１」があるため初めから１が入っている）
count=1
    
#MDの約数の中で素数のみをカウント(2以上、√MD以下の数）
for i in range(2,int(math.sqrt(MD))+1):
    if MD%i==0:
        count+=1
        while MD%i==0:
            MD=MD/i
    else:
        pass
#MDの約数の中で√MDより大きい素数は高々一つだからその確認
if MD!=1:
    count+=1
else:
    pass
print(count)    


Measured memory_bytes: 3064
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll A, B;
    cin >> A >> B;

    print(A * B / __gcd(A, B));
    
}


Measured memory_bytes: 3652
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
 
		int n = sc.nextInt();
		int l = sc.nextInt();
		int taste[] = new int[n];
		int minTaste = l + 1;
		for(int i = 0 ; i < n ; i++) {
			taste[i] = l + i;
			if(Math.abs(minTaste) > Math.abs(taste[i])) {
				minTaste = taste[i];
			}
		}
		int sum = Arrays.stream(taste).sum();
		System.out.println(sum - minTaste);
 
		sc.close();
 
	}
 
}

Measured memory_bytes: 28620
#include<iostream>
using namespace std;
int main(){
    string S;
    cin >> S;
    int len = S.length();
    int flag=1;
    for(int i=0;i<len;i += 2){
        if(S.at(i)=='L') flag=0;
    }
    for(int i=1;i<len;i += 2){
        if(S.at(i)=='R') flag=0;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main() {
  int H,N;cin>>H>>N;
  vector<int> a(N);
  int sum=0;
  for(int i=0;i<N;i++){
    cin>>a.at(i);
    sum+=a.at(i);
  }
  if(H<=sum){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

using namespace std;

int main(){

	int a, b, c;
	string str, command, s;

	cin >> str >> c;

	for (int i = 0; i < c;i++){

		cin >> command;

		if (command == "print"){
			cin >> a >> b;
			while (a <= b){
				cout << str[a];
				a++;
			}
			cout << endl;
		}
		else if (command == "replace"){
			cin >> a >> b >> s;
			str.replace(a, b - a + 1, s);
		}
		else{
			cin >> a >> b;
			for (int j = 0; j < (b - a + 1) / 2;j++){
				swap(str[a + j], str[b - j]);
			}
		}
	}

	return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main()
{
ll ans=100000,d,g;
cin >> d>>g;
ll que[d];
ll comp[d];
rep(i,d){
    cin >>que[i]>>comp[i];
}

for(int i=0;i<1024;i++){
    ll sco=0,q=0,dd;
    if(i>>d)break;
    rep(j,d){
        if(i>>j&1){sco+=(j+1)*100*que[j]+comp[j];q+=que[j];}
    }
    for(ll j = d-1; j >=0 ; j--){
        if(sco>=g)break;
        if(!(i>>j&1)){dd=j;break;}
    }
    //cout << q <<' '<<sco<<' '<<dd<<' ';
    
    rep(i,que[dd]){
        if(sco>=g)break;
        sco+=(dd+1)*100;
        q++;
    }
    //cout << q <<' '<<sco<< endl;
    if(ans>q&&sco>=g)ans=q;
}


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





Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String... args) {
        int N = IN.nextInt();
        int M = IN.nextInt();
        int[] a = new int[M];
        int[] b = new int[M];
        ArrayList<Integer> xr = new ArrayList<Integer>();
        for (int i = 0; i < M; i++) {
            a[i] = IN.nextInt();
            b[i] = IN.nextInt();
            xr.add(i);
        }
        xr.sort((i, j) -> {
            int tmp = a[i] - a[j];
            return tmp != 0 ? tmp : b[i] - b[j];
        });
        int sunk = N;
        int ans = 0;
        int left = -1;
        int rMin = -1;
        for (int x : xr) {
            if (left != a[x]) {
                left = a[x];
                rMin = b[x];
            } else {
                continue;
            }
            if (sunk <= left) {
                sunk = rMin;
                ans++;
            } else {
                if (rMin < sunk) {
                    sunk = rMin;
                }
            }
        }
        puts(ans + 1);
    }
    static final Scanner IN = new Scanner(System.in);
    static <T> void puts(T arg) { System.out.println(arg); }
}


Measured memory_bytes: 97164
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
#include <cmath>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int n;
  scanf("%d", &n);
  double x[4], y[4];
  const double EPS = 1e-12;
  for (int z = 0; z < n; z++) {
    for (int i = 0; i < 4; i++) {
      scanf("%lf%lf", &x[i], &y[i]);
    }
    printf("%s\n", abs((y[1]-y[0])*(x[3]-x[2])-(y[3]-y[2])*(x[1]-x[0])) < EPS ? "YES" : "NO");
  }
}

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

int main() {
  string A,B;
  cin >> A >> B;
  int cnt=0;
  for (int i=0; i<A.length(); i++){
    if(A.at(i)!=B.at(i)){
      cnt++;
    }
  }
      
  cout << cnt << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<vector<int>> V(100, vector<int>(100, 0));
	for (int i = 0; i < n; i++){
		int u, k;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int v;
			cin >> v;
			V.at(u - 1).at(v - 1) = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cout << V.at(i).at(j);
			if (j == n - 1) {
				cout << endl;
			}
			else
				cout << " ";
		}
	}
}


Measured memory_bytes: 3180
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int num = Integer.parseInt(br.readLine());
			if(num == 0){
				break;
			}
			int[] su = new int[num];
			String[] str = br.readLine().split(" ");

			for(int i = 0; i < str.length; i++){
				su[i] = Integer.parseInt(str[i]);
			}

			double sum = 0;

			for(int i = 0; i < su.length; i++){
				sum += su[i];
			}

			double avg = sum / num;
			double result = 0;

			for(int i = 0; i < num; i++){
				result += (Math.pow((su[i] - avg), 2)/num);
			}
			System.out.println(Math.sqrt(result));
		}
	}
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

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

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int n = input();

    range(i, 0, n) {
        int a = input();
        if (a & 1) continue;
        if (a % 3 == 0 || a % 5 == 0) continue;

        cout << "DENIED" << endl;
        return;
    }

    cout << "APPROVED" << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

// Preparing for IOI 2018

using namespace std;

const int inf = (int) 1e9 + 7;
const int N = (int) 1e5 + 7;
const double PI = 3.141592653589793238462643;
const double eps = 0.000000001;

#define ok puts("OK");
#define ll long long
#define fr first
#define sc second
#define eb emplace_back
#define sz(s) ((int)s.size())
#define all(s) s.begin(), s.end()

inline void solve () {
	int n; cin >> n;
	map < int, int > mp;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		mp[-a]++;
	}
	vector < int > two, four;
	for (map < int, int > :: iterator it = mp.begin(); it != mp.end(); it++) {
		int a = -(it -> fr);
		int b = it -> sc;
		if (b > 1) {
			two.push_back(a);
		}
		if (b > 3) {
			four.push_back(a);
		}
	}
	ll ans = 0;
	sort(all(two), greater < int > ());
	sort(all(four), greater < int > ());
	for (int i = 1; i < sz(two); i++) {
		ans = max(ans, 1LL * two[i] * two[i - 1]);
	}
	for (int i = 0; i < sz(four); i++) {
		ans = max(ans, 1LL * four[i] * four[i]);
	}
	cout << ans;
}

int test = 1;

main () {
        // freopen("example.in", "r", stdin); freopen("example.out", "w', stdout);
        // scanf ("%d", &test);
        while (test--) {
                solve();
        }
}


Measured memory_bytes: 4992
/*
 * main.c
 *
 *  Created on: 2019/02/20
 *      Author: family
 */

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

typedef struct {
	int p;
	int year;
	int no;
	int seq_num;
} city_data_t;

city_data_t data[100001] = {0};

int sort_inc_year(const void *a, const void *b)
{
	int dta = ((city_data_t*)a)->year;
	int dtb = ((city_data_t*)b)->year;
	//printf("%llu %llu\n",dta, dtb);
	return (dta - dtb);
}

int sort_inc_no(const void *a, const void *b)
{
	int dta = ((city_data_t*)a)->no;
	int dtb = ((city_data_t*)b)->no;
	//printf("%d %d\n",dta, dtb);
	return (dta - dtb);
}

int sort_inc_pref(const void *a, const void *b)
{
	int dta = ((city_data_t*)a)->p;
	int dtb = ((city_data_t*)b)->p;
	//printf("%d %d\n",dta, dtb);
	if (dta == dtb) {
		dta = ((city_data_t*)a)->year;
		dtb = ((city_data_t*)b)->year;
	}
	return (dta - dtb);
}

void printdata(int m)
{
	int i = 0;
	for(i = 0; i < m; i++) {
		printf("p=%d,y=%llu,n=%d\n", data[i].p, data[i].year, data[i].no);
	}
}

int main()
{
	int n_pref = 0;
	int m_city = 0;
	int i = 0;
	int v = 1;
	int pref_no = 0;
	scanf("%d %d", &n_pref, &m_city);
	for(i = 0; i < m_city; i++) {
		int a = 0;
		unsigned long long int b = 0;
		scanf("%d %llu", &a, &b);
		data[i].p = a;
		data[i].year = b;
		data[i].no = i;
	}
	qsort(data, m_city, sizeof(city_data_t), sort_inc_pref);
	//printdata(m_city);
	for(i = 0; i < m_city; i++) {
		if(pref_no != data[i].p) {
			v = 1;
			pref_no = data[i].p;
		}
		data[i].seq_num = v++;
	}
	qsort(data, m_city, sizeof(city_data_t), sort_inc_no);
	//printdata(m_city);
	for(i = 0; i < m_city; i++) {
		printf("%06d%06d\n",data[i].p,data[i].seq_num);
	}
	return 0;
}


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


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

    int p,q,r;
    cin>>p>>q>>r;
    int ans = min(q+p,q+r);
    ans = min(p+r,ans);
    cout<< ans <<endl;
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;

string S;

int main() {
    cin >> S;
    string res = (S[2]==S[3] && S[4]==S[5]) ? "Yes" : "No";
    cout << res << endl;
}


Measured memory_bytes: 3600
n,d=map(int,input().split())
x_list=[]
for i in range(n):
    sub_list=list(map(int,input().split()))
    x_list.append(sub_list)
import math
ans=0
for i in range(n):
    for j in range(i+1,n):
        v=0
        for k in range(d):
            v+=(x_list[i][k]-x_list[j][k])**2
        r=math.sqrt(v)
        if r.is_integer():
            ans+=1
print(ans)


Measured memory_bytes: 39828
#include <iostream>
#include <string>
using namespace std;
 
int main(){
  int mp[6][2];
  for(int i=0;i<6;i++)
    for(int j=0;j<2;j++) 
      mp[i][j] = -1;
 
  mp[0][0] = 2;
  mp[0][1] = 3;
  mp[1][0] = 3;
  mp[1][1] = 2;
  mp[2][0] = -1;
  mp[2][1] = 4;
  mp[3][0] = 2;
  mp[3][1] = -1;
  mp[4][0] = 5;
  mp[4][1] = 1;
  mp[5][0] = 1;
  mp[5][1] = 3;
 
  string str;
  while(1) {
    cin >> str;
    if(str[0] == '#') break;
 
 
    int ima = 0;
    for(int i=0;i<str.size();i++) {
      ima = mp[ima][str[i]-'0'];
      if(ima == -1) break;
    }
    if(ima == 1) cout <<"Yes" << endl;
    else cout << "No" << endl;
 
  }
 
  return 0;
 

}

Measured memory_bytes: 1176
object Main {
  def main(args: Array[String]) = {
    val n = io.StdIn.readInt()
    for (loop <- 1 to n) {
      val a = io.StdIn.readLine()
      val b = io.StdIn.readLine()
      var dp = Array.ofDim[Int](a.length+1, b.length+1)

      for(i <- 0 until a.length) {
        for(j <- 0 until b.length) {
          if (a(i) == b(j)) {
            dp(i+1)(j+1) = dp(i)(j) + 1
          } else {
            dp(i+1)(j+1) = math.max(dp(i)(j+1), dp(i+1)(j))
          }
        }
      }
      println(dp(a.length)(b.length))
    }
  }
}

Measured memory_bytes: 124356
def main():
    X = int(input())
    # 500円をp個、5円をq個とすると。500p+5q=Xが成り立ち、ansは1000p+5qになる
    pmax = int(X/500)
    ans = 0
    tmp = 0
    for p in range(pmax+1):
        q = int((X-500*p)/5)
        tmp = 1000*p + 5*q
        ans = max(ans,tmp)
    print(ans)

main()


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int W, a, b;
    cin >> W >> a >> b;
    if (a + W < b) {
        cout << (b - (a + W)) << endl;
    } else if (b + W < a) {
        cout << (a - (b + W)) << endl;
    } else {
    // if ((a <= b && b <= a + W) || (b + W <= a + W && a <= b + W)) {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = do
  n <- readLn
  print $ solve n

solve :: Int -> Int
solve n = minimum $ map sum $ [(ndigits 6 m) ++ (ndigits 9 (n - m)) | m <- [0..n]]

ndigits :: Int -> Int -> [Int]
ndigits k n = reverse $ inner n k
  where
    inner 0 _ = []
    inner n k = (n `mod` k):inner (n `div` k) k


Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string

int main() {
    string s;
    cin >> s;
    int n1= (int) s.at(0)-48, n2= (int) s.at(1)-48, n3= (int) s.at(2)-48, n4= (int) s.at(3)-48, op;
    rep(i,8) {
        int value = n1;
        if (i & (1<<0)) value += n4;
        else value -= n4;
        if (i & (1<<1)) value += n3;
        else value -= n3;
        if (i & (1<<2)) value += n2;
        else value -= n2;
        if (value == 7) {op = i; break;}
    }
    ct(n1);
    if (op & (1<<2)) ct("+");
    else ct("-");
    ct(n2);
    if (op & (1<<1)) ct("+");
    else ct("-");
    ct(n3);
    if (op & (1<<0)) ct("+");
    else ct("-");
    ct(n4);
    ct("=7");
    ct(endl);

}


Measured memory_bytes: 256
n=int(input())
s=[input() for _ in range(n)] 

ac=0
wa=0
tle=0
re=0

for i in s:
    if i =='AC':
        ac+=1
    if i =='WA':
        wa+=1
    if i =='TLE':
        tle+=1
    if i =='RE':
        re+=1

print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

Measured memory_bytes: 16164
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.1415926535897932;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int n;
ll sum = 0;
int ans[20000];

int main() {
    cin >> n;
    int now = 1;
    rep(i,n-2) {
        now++;
        while (now%2 != 0 && now%3 != 0 && now%5 != 0) now++;
        ans[i] = now;
        sum += now;
    }
    now++;
    while ((now%2 != 0 && now%3 != 0 && now%5 != 0) || ((sum+now)%2 != 0 && (sum+now)%3 != 0 && (sum+now)%5 != 0)) now++;
    ans[n-2] = now;
    sum += now;

    for (int i = now+1;; i++) {
        if ((sum + i)%2 == 0 && (sum+i)%3 == 0 && (sum+i)%5 == 0 && (i%2 == 0 || i%3 == 0 || i%5 == 0)) {
            ans[n-1] = i;
            break;
        }
    }
    rep(i,n) {
        cout << ans[i];
        if (i == n-1) cout << endl;
        else cout << " ";
    }
}

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

using namespace std;
#define forr(i, n) for(ll i = n-1; i >= 0; i--)
#define forn(i, n) for(ll i = 0; i < n; i++)
#define forab(i, a, n) for(ll i = a; i < n; i++)
#define forabr(i, a, b) for(ll i = a; i >= b; i--)
#define endl '\n'
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(7); cout.setf(ios::fixed);
#define fale_io ifstream fin("grants.in"); ofstream fout("grants.out");
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

typedef long long ll;
typedef string S;

const ll mod = 1e9 + 7;
const ll Inf = LONG_LONG_MAX;
const double long PI = 3.1415926535;

ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll max(ll a, ll b){if(a > b)return a;return b;}
ll gcd (ll a, ll b) {while (b) {a %= b;swap (a, b);}return a;}
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }

int n, x, y;
int ans[2100];

int get(int a, int b){
    if(a >= x && a <= y){
        if(b >= x && b <= y)
            return min(a - b, y - a + 1 + b - x);
        return x - b + min(a - x, 1 + y - a);
    }
    if(b >= x && b <= y)
        return min(a - b, b - x + 1 + a - y);
    if(a < x || b > y)
        return a - b;
    return x - b + 1 + a - y;
}

int main() {
    fast_io;
    cin >> n >> x >> y;
    x--;
    y--;
    forn(i, n)
        forn(j, i)
            ans[get(i, j)]++;
    forab(k, 1, n){
        cout << ans[k] << endl;
    }
}


Measured memory_bytes: 256
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    long a, b, c, d;
    scan(a, b, c, d);
    auto tmp = new long[](100000);
    foreach (i; a .. b)
    {
        tmp[i] += 1;
    }
    foreach (i; c .. d)
    {
        tmp[i] += 1;
    }
    // writeln(tmp);
    long cnt;
    foreach (i; 0 .. tmp.length)
    {
        if (tmp[i] == 2)
        {
            cnt += 1;
        }
    }
    writeln(cnt);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


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

int main(){
	string s;
	getline(cin,s);
	int a1=0,a2=s.size()-1;
	while(s[a1]!='A') a1++;
	while(s[a2]!='Z') a2--;
	cout<<a2-a1+1; 
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<string> vecstr;
typedef vector<char> vecchar;
typedef vector<bool> vecbool;
typedef vector<vector<bool>> vec2bool;
typedef vector<vector<int>> vec2int;
typedef vector<vector<double>> vec2d;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  int h, w;
  cin >> h >> w;
  vecstr g(h);
  for (auto& e : g) cin >> e;
  vec2int yoko(h, vecint(w, 0));
  vec2int tate(h, vecint(w, 0));
  REP(i, h) {
    int cnt = 0;
    REP(j, w) {
      if (g[i][j] == '.') {
        cnt++;
        yoko[i][j] = cnt;
      } else {
        cnt = 0;
      }
    }
    for (int j = w - 1; j >= 0; j--) {
      if (yoko[i][j] != 0) {
        cnt = max(cnt, yoko[i][j]);
        yoko[i][j] = cnt;
      } else {
        cnt = 0;
      }
    }
  }
  REP(j, w) {
    int cnt = 0;
    REP(i, h) {
      if (g[i][j] == '.') {
        cnt++;
        tate[i][j] = cnt;
      } else {
        cnt = 0;
      }
    }
    for (int i = h - 1; i >= 0; i--) {
      if (tate[i][j] != 0) {
        cnt = max(cnt, tate[i][j]);
        tate[i][j] = cnt;
      } else {
        cnt = 0;
      }
    }
  }
  // REP(i, h) {
  //   REP(j, w) { cout << setw(2) << left << yoko[i][j]; }
  //   cout << endl;
  // }
  int ans = 0;
  REP(i, h) {
    REP(j, w) {
      if (g[i][j] == '#') continue;
      ans = max(tate[i][j] + yoko[i][j] - 1, ans);
    }
  }
  cout << ans << endl;
  // int ans = 0;
  // REP(i, h) {
  //   REP(j, w) {
  //     if (g[i][j] == '#') continue;
  //   }
  // }
}


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

public class Main {

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

    int n = sc.nextInt();
    int k = sc.nextInt();
    int q = sc.nextInt();

    int[] points = new int[n];
    Arrays.fill(points, k);

    for (int i = 0; i < q; i++) {
      int p = sc.nextInt();
      points[p - 1]++;
    }

    for (int point : points) {
      if (point - q >= 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}


Measured memory_bytes: 59228
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  if ((a[0] == a[1] && a[2] == a[3]) || (a[0] == a[2] && a[1] == a[3]) || (a[0] == a[3] && a[1] == a[2])) {
    if ((a[0] == a[1] && a[2] == a[3]) && (a[0] == a[2] && a[1] == a[3]) && (a[0] == a[3] && a[1] == a[2])) {
      cout << "No";
      return 0;
    }
    cout << "Yes";
  } else {
    cout << "No";
  }
    
}


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

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

class Point
{
public:
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(a * x, a * y); }
	Point operator / (double b) { return Point(x / b, y / b); }
	friend istream& operator >> (istream & s, Point p) { s >> p.x >> p.y; }

	double dot(Point a, Point b) { return a.x* b.x + a.y * b.y; }
	double abs() { return sqrt(norm()); }
	double norm() { return x * x + y * y; }

	bool operator <(const Point & p)const { return x != p.x ? x < p.x : y < p.y; }
	bool operator == (const Point & p) const { return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; }
};
typedef Point Vector;

struct Segment {
	Point p1, p2;
	Segment() {}
	Segment(Point p1, Point p2) :p1(p1), p2(p2) {}
};
typedef Segment Line;

double norm(Vector a) { return a.x* a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a)); }

double dot(Vector a, Vector b) { return a.x* b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x* b.y - a.y * b.x; }

int ccw(Point p0, Point p1, Point p2) {        //判断有三个点构成的两个向量之间的关系（相反，同向（谁更大），逆时针方向，顺时针方向）
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;   //如果外积为正，那么就是顺时针
	if (cross(a, b) < -EPS) return CLOCKWISE;                             //如果外积为负，那么就是逆时针
	if (dot(a, b) < -EPS) return ONLINE_BACK;              //上面两种情况都不符合的时候，就一定在一条直线上，如果内积为负，那就是相反方向
	if (a.norm() < b.norm()) return ONLINE_FRONT;  //如果上面条件还不符合的话，那就按看谁的大了，
	return ON_SEGMENT;                 
}



bool intersect(Point p1, Point p2, Point p3, Point p4) {
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
		ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

int main()
{
	int q;
	cin >> q;
	double x0, y0, x1, y1, x2, y2, x3, y3;
	while (q--)
	{
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		Point p0 = Point(x0, y0), p1 = Point(x1, y1), p2 = Point(x2, y2), p3 = Point(x3, y3);
		cout << intersect(p0, p1, p2, p3) << endl;
	}
	return 0;
}


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

using namespace std;

int n,k,ans;

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		if(x>=k)ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 45
int main(){
  int i,n,F[N];
  scanf("%d",&n);
  F[0] = F[1] = 1;
  for(i = 2; i < N; i++){
    F[i] = F[i-1]+F[i-2];
  }
  printf("%d\n",F[n]); 

  return 0;
}

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

typedef pair<int,int> pii;

const int N = 2e5;

pii li[N+5];
int n;
int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> li[i].second >> li[i].first;
	}
	sort(li+1,li+n+1);
	int cur = li[n].first;
	for(int i=n;i>=1;i--){
		int lambat = li[i].first - li[i].second;
		cur -= li[i].second;
		cur = min(lambat,cur);
//		cout << cur << endl;
	}
	if(cur < 0) cout << "No\n";
	else cout << "Yes\n";
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  int n = N;
  int s = 0;
  while(n > 0) {
    s += n % 10;
    n /= 10;
  }
  if(N % s == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    while(1){
        ll h,w;cin>>h>>w;
        if(h==0&&w==0)return;
        rep(i,h){
            rep(j,w){
                cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
}

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



Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair

int main(){
  int N;
  cin>>N;
  VI A(N);
  rep(i,N) cin>>A[i];
  int ans=0;
  int F=2;
  rep(i,N) if(i){
    if(F==1){
      if(A[i]<A[i-1]){
        ans++;
        F=2;
      }
    }else if(F==0){
      if(A[i]>A[i-1]){
        ans++;
        F=2;
      }
    }else{
      if(A[i]<A[i-1]) F=0;
      else if(A[i]>A[i-1]) F=1;
    }
  }
  cout<<1+ans<<endl;
}

Measured memory_bytes: 640
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B
while true
    n,x = gets.split.map(&:to_i)
    break if n == 0 && x == 0
    
    cnt=0
    for i in 1..n
    for j in (i+1)..n
    for k in (j+1)..n
        cnt+=1 if i+j+k==x
    end
    end
    end
    
    puts cnt
end

Measured memory_bytes: 6104
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = input()
if n%2:
    print('No')
else:
    for i in range(n//2):
        if s[i] == s[i+n//2]:
            continue
        print('No')
        break
    else:
        print('Yes')

Measured memory_bytes: 38256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int K = sc.nextInt();
    	boolean[] sunuke = new boolean[N];
    	for (int i = 0; i < K; i++) {
    		int d = sc.nextInt();
        	for (int j = 0; j < d; j++) {
        		sunuke[sc.nextInt() - 1] = true;
        	}
        }
    	int sum = 0;
    	for(int i = 0; i < N; i++) {
    		if(!sunuke[i])sum++;
    	}
    	System.out.println(sum);
    }
}

Measured memory_bytes: 37336
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker,"/stack:200000000")
#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define print(x) return cout<<x<<endl,0
#define watch(x) cerr<<#x<<"-> "<<x<<endl
#define CLEAR(x,val) memset(x,val,sizeof(x))
// #define int long long

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

const int INF = 1000000000;
const int MOD = 1000000007; //998244353

signed main()
{	
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	cin.tie(0), cout.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	vector<pii> v(n);
	for(int i=0;i<n;i++)
		cin	>> v[i].first >> v[i].second;
	sort(v.begin(),v.end());
	long double sum = 0;
	int cnt = 0;
	do
	{		
		long double dist = 0;
		for(int i=1;i<n;i++)
			dist+=sqrt((v[i].first-v[i-1].first)*(v[i].first-v[i-1].first)+(v[i].second-v[i-1].second)*
				(v[i].second-v[i-1].second));
		sum += dist;
		cnt++;
	}while(next_permutation(v.begin(),v.end()));
	cout<<fixed<<setprecision(12)<<sum/(long double)cnt<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define fi first
#define se second
template <typename A, typename B> inline bool chmax(A &a, B b) {if (a < b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline bool chmin(A &a, B b) {if (a > b) {a = b; return 1;} return 0;}
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const double EPS = 1e-9;
const bool debug = 0;
/****************************/

int N, R;
int maps[100][100];

bool check(double cy) {
	REP(i, 100) REP(j, 100) {
		if (!maps[i][j]) {
			int x[4] = {j, j, j + 1, j + 1};
			int y[4] = {i, i + 1, i + 1, i};
			REP(k, 4) {
				double dx = x[k] - 50;
				double dy = y[k] - cy;
				if (dx*dx + dy*dy < R*R - EPS) return false;
			}
		}
	}
	
	return true;
}

int main() {
	while (cin >> R >> N, R || N) {
		memset(maps, 0, sizeof(maps));
		
		REP(t, N) {
			int l, r, h;
			scanf("%d %d %d", &l, &r, &h);
			l += 50; r += 50;
			
			FOR(j, l, r) REP(i, h) maps[i][j] = 1;
			
		}
		
		double l = -R, r = 50;
		REP(t, 50) {
			double m = (l + r) / 2;
			(check(m) ? l : r) = m;
		}
		
		if (debug) printf("@ ");
		printf("%.15f\n", l + R);
	}
}



Measured memory_bytes: 3244
def main():
    n = int(input())
    count = 0
    a, b = 1, 1
    for i in range(1, n):
        for j in range(i, n):
            if i*j >= n:
                break
            if i == j:
                count += 1
            else:
                count += 2
    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 67880
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <cerrno>
#include <stdio.h>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    char s[101];

    while(true){

        fgets(s,102,stdin);

        if(s[0]=='.'){
            break;
        }

        int j=0;

        while(s[j]!='.')j++;

        stack<char> st;

        bool flag = true;

        for(int i=0;i<j;i++){
            if(s[i] == '('){
                st.push('(');
            }
            else if(s[i] == '['){
                st.push('[');
            }
            else if(s[i] == ')'){
                if(st.empty()){
                    flag = false;
                    break;
                }
                else if(st.top()!='('){
                    flag = false;
                    break;
                }
                else{
                    st.pop();
                }
            }
            else if(s[i] == ']'){
                if(st.empty()){
                    flag = false;
                    break;
                }
                else if(st.top()!='['){
                    flag = false;
                    break;
                }
                else{
                    st.pop();
                }
            }
        }
        if(flag){
            if(st.empty()){
                cout << "yes" << endl;
            }
            else{
                cout << "no" << endl;
            }
        }
        else{
            cout << "no" << endl;
        }
    }
    return 0;
}


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

int main(){
	int N, M;
  	int a, b;
  	bool exist_route = false;
  
  	cin >> N >> M;
  	vector<bool> pass(N+1, false);
  
  	for (int i=0; i<M; i++){
      cin >> a >> b; 
      if( a == 1){
        if(pass[b]){
        	exist_route = true;
        }
      	pass[b] = true;
      }
      else if( b == N ){
        if(pass[a]){
        	exist_route = true;
        }
      	pass[a] = true;
      }
    }
  

	if( exist_route){
      cout << "POSSIBLE";
    }  
  	else{
        cout << "IMPOSSIBLE";
    }
  
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Tree {
  int key;
  struct Tree *parent, *left, *right;
};

struct Tree *root, *nill;

void insert(int key) {
  struct Tree *x, *y, *z;
  y = nill;
  x = root;

  z = malloc(sizeof(struct Tree));
  z->key = key;
  z->left = nill;
  z->right = nill;

  while (x != nill) {
    y = x;
    if (key < x->key)
      x = x->left;
    else
      x = x->right;
  }
  z->parent = y;

  if (y == nill) {
    root = z;
  }
  else if (z->key < y->key)
    y->left = z;
  else
    y->right = z;
}

void inorder(struct Tree *t) {
  if (t->left != nill)
    inorder(t->left);
  printf(" %d", t->key);
  if (t->right != nill)
    inorder(t->right);
}

void preorder(struct Tree *t) {
  printf(" %d", t->key);
  if (t->left != nill)
    preorder(t->left);
  if (t->right != nill)
    preorder(t->right);
}

int main(void) {
  int n, key;
  char s[10];

  nill = (struct Tree *)malloc(sizeof(struct Tree));

  root = nill;
  
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    if (strcmp(s, "insert") == 0) {
      scanf("%d", &key);
      insert(key);
    }
    else {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }


  return 0;
}



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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(long long i=0;i<(n);i++)

int main() {
  long long N;
  cin >> N;
  vector<long long> c(5);
  REP(i, 5) {
    cin >> c[i];
  }
  long long ans = 0;
  long long b = *min_element(c.begin(), c.end());
  if(N <= b) {
    cout << 5 << endl;
  } else {
    ans += N / b;
    if(N % b != 0) ans++;
    ans += 4;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
s = list(input())
s0 = list(reversed(s))
s1 = list(reversed(s[0:int((len(s)-1)/2)]))
s2 = list(reversed(s[int((len(s)+3)/2)-1:len(s)]))
if s[0:int((len(s)-1)/2)] == s1 and s[int((len(s)+3)/2)-1:len(s)] == s2 and s == s0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064