akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

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

  int K;
  cin>>K;

  ll ans=0;
  for(int i=1;i<=K;i++) for(int j=1;j<=K;j++) for(int k=1;k<=K;k++){
    int g=gcd(i,j);
    g=gcd(g,k);
    ans+=g;
  }

  cout<<ans<<endl;

  return 0;
}


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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

int main()
{
	std::ios_base::sync_with_stdio(0);
	
	u64 n;

	std::cin >> n;

	std::vector<std::pair<u64,u64>> divs;

	for(u64 i=1; i<=std::sqrt(n); i++)
	{
		if(n % i==0)
		{
			if(n/i == i)
			{
				divs.emplace_back(i,i);
			}
			else
			{
				divs.emplace_back(i, n/i);
			}
		}
	}

	std::sort(divs.begin(), divs.end(), [](const auto& a, const auto& b) { return a.first + a.second < b.first + b.second; });

	std::cout << (divs[0].first-1 + divs[0].second-1) << "\n";
	
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define PI 3.14159265358979
int main()
{
	double a,b, c, h, m,d;
	scanf("%lf%lf%lf%lf", &a, &b, &h, &m);
	if (30.0 * h - 6.0 * m + m / 2.0 > 0)
	{
		d = 30.0 * h - 6.0 * m + m / 2.0;
	}
	else
	{
		d= 6.0 * m- 30.0 * h - m / 2.0;
	}
	if (d > 180)
	{
		d = 360.0 - d;
	}
	if (d == 0)
	{
		printf("%.20lf",fabs(b-a));
	}
	else if (d == 180)

	{
		printf("%.20lf", a + b);
	}
	else
	{
		c = sqrt(a * a + b * b - 2.0 * a * b * cos(d * PI / 180.0));
		printf("%.20lf", c);
	}
    return 0;
}

Measured memory_bytes: 2596
#include<iostream>
#include<vector>
#include<queue>

using ll = long long;
using namespace std;

const int INF = 1001001001;
const int MOD = 1000000007;

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

	vector<int> h(n);
	for (int i = 0;i < n;i++) cin >> h[i];

	vector<int> dp(n, INF);
	dp[0] = 0;

	for (int i = 0;i < n;i++){
		for (int j = 1;j < k+1;j++){
			int v = i;
			int vv = v+j;
			if (vv > n-1) continue;

			dp[vv] = min(dp[vv], dp[v] + abs(h[vv] - h[v]));
		}
	}

	cout << dp[n-1] << endl;

	return 0;
}


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

int main() {
    char op;
    cin >> op;
    if (op == 'a' || op == 'i' || op == 'u' || op == 'e' || op == 'o') {
        cout << "vowel" << endl;

    }else {
        cout << "consonant" << endl;
    }



}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
//#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

int main() {
    int N;
    std::cin >> N;
    std::map<int, int> map;
    while(N--) {
        int a;
        std::cin >> a;
        auto itr = map.find(a);
        if(itr == std::end(map)) map.insert({a, 1});
        else ++itr->second;
    }
    long long x = 0;
    long long y = 0;
    for(auto itr = rbegin(map); itr != rend(map); ++itr) {
        if(x == 0) {
            if(4 <= itr->second) {
                x = itr->first;
                y = itr->first;
                break;
            } else if(2 <= itr->second) {
                x = itr->first;
            }
        } else {
            if(2 <= itr->second) {
                y = itr->first;
                break;
            }
        }
    }

    std::cout << x * y << std::endl;

    return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
int main(void)
{
  int N, i, red=0, blue=0;
  char s[N];
  scanf("%d", &N);
  scanf("%s", s);
  for(i=0; i<N; i++) {
    if(s[i]=='R') {
      red++;
    }
    else {
      blue ++;
    }
  }
  if(red >blue) {
    printf("Yes");
  }
  else {
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 128
var
	r,b,target:string;
    i,j,k: integer;
begin   

	k := 0;
    
    readln(r);
    readln(i, j);
    readln(target);
   
    k := Pos(target,r);
    
    if k = 1 then
    begin
    	dec(i);
    end
    else
    begin
    	dec(j);
    end;
    write(i);
    write(' ');
    write(j);
    
end.

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

using namespace std;

const int N = 105, K = 1e5 + 5, MOD = 1e9 + 7;
int n, p, dp[N][K], prefix[N][K], a[N];

inline int add(int a, int b){
	a += b;
	if(a >= MOD)a -= MOD;
	return a;
}

inline int sub(int a, int b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	cin>>n>>p;
	for(int i=1;i<=n;++i)cin>>a[i];

	for(int i=0;i<=n;++i)dp[i][0] = prefix[i][0] = 1;
	for(int j=0;j<=p;++j)prefix[0][j] = 1;

	for(int i=1;i<=n;++i)
		for(int j=1;j<=p;++j){
			// coefficient of x^j is prefix[i - 1][j - a[i] : j];

			int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
			int last = prefix[i - 1][j];
			dp[i][j] = add(dp[i][j], sub(last, first));
			prefix[i][j] = add(prefix[i][j - 1], dp[i][j]);
		}

	cout<<dp[n][p]<<"\n";
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
from collections import deque

H, W = [int(_) for _ in input().split()]
S = [input() for _ in range(H)]


di = (1, 0, -1, 0)
dj = (0, 1, 0, -1)
visited = [[False] * W for _ in range(H)]

result = 0
for i in range(H):
    for j in range(W):

        if visited[i][j]:
            continue
        visited[i][j] = True

        b, w = 0, 0

        que = deque([(i, j)])
        while que:
            (ci, cj) = que.pop()
            if S[ci][cj] == '#':
                b += 1
            else:
                w += 1

            for d in range(4):

                ni, nj = ci + di[d], cj + dj[d]
                if not (0 <= ni < H and 0 <= nj < W):
                    continue

                if S[ci][cj] == S[ni][nj]:
                    continue

                if visited[ni][nj]:
                    continue
                visited[ni][nj] = True

                que.append((ni, nj))

        result += b * w


print(result)



Measured memory_bytes: 49116
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
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;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

typedef long double ld;

int64 gcd(int64 a, int64 b) { return b? gcd(b,a%b):a; }; int64 lcm(int64 a, int64 b) { return a/gcd(a,b)*b; };


int main() {
    int64 a,b,c;
    cin >> a >> b >> c;

    int64 x = c - a - b;
    if ( x > 0 && 4*a*b < x*x ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static int[] CountingSort(int[] A, int k) {
        int n = A.length;
        int[] B = new int[n];
        int[] C = new int[k];
        for (int i = 0; i < n; i++) {
            C[A[i]]++;
        }
        for (int i = 1; i < k; i++) {
            C[i] += C[i - 1];
        }
        for (int j = n - 1; j >= 0; j--) {
            B[C[A[j]] - 1] = A[j];
            C[A[j]]--;
        }
        return B;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] A = new int[k];
        for (int i = 0; i < k; i++) {
            A[i] = sc.nextInt();
        }
        int[] B = CountingSort(A, 10001);
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < k; i++) {
            ans.append(B[i]);
            if (i == k - 1) {
                ans.append("\n");
            } else {
                ans.append(" ");
            }
        }
        System.out.print(ans);
        sc.close();
    }
}

Measured memory_bytes: 507824
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int r = int.Parse(In[0]);
            int d = int.Parse(In[1]);
            int x2000 = int.Parse(In[2]);
            int temp = x2000;
            for(int i = 0; i < 10; i++)
            {
                temp = r * temp - d;
                Console.WriteLine(temp);
            }
        }
    }
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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

int main(){
	int N; cin >> N;
    vector<int> L;
    int sum = 0;
    REP(i,N){
        int l;
        cin >> l;
        L.PB(l);
    }

    sort(ALL(L));
    reverse(ALL(L));

    REP(i,N){
        sum += L[i];
    }

    if (sum - L[0] > L[0]){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b,c,d;
	for(c=0;c<3000;c++){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		if(a>b){
			d=a;
			a=b;
			b=d;
		}
		printf("%d %d\n",a,b);
	}
	return 0;
}


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

using namespace std;

const int DIM = 25;

int v1[DIM];
int v2[DIM];
int v3[DIM];

main()
{
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
		cin >> v1[i];
	
	for(int i = 1; i <= n; i++)
		cin >> v2[i];
	
	for(int i = 1; i < n; i++)
		cin >> v3[i];
	
	int last = -1;
	
	int sum = 0;
	
	for(int i = 1; i <= n; i++)
	{
		sum += v2[v1[i]];
		
		if(v1[i] == last + 1)
			sum += v3[last];
		
		last = v1[i];
	}
	
	cout << sum;
}

Measured memory_bytes: 256
def funuke():                                   
    N = int(raw_input())                        
    strs = []                                   
    for n in range(N):                          
        input_lines = raw_input()               
        strs.append(list(input_lines))          
    result = strs[0]                            
    for n in range(1,N):                        
        result = duplicate(result, strs[n])     
    result.sort()                               
    print("".join(result))                      
                                                
def duplicate(xs,ys):                           
    result = []                                 
    for x in xs:                                
        if x in ys:                             
            result.append(x)                    
            ys.remove(x)                        
    return result                               
                                                
                                                
if __name__=="__main__":                        
    funuke()                                    

Measured memory_bytes: 2692
#include<bits/stdc++.h>
using namespace std;
#define int long long 

char table[110][110];

const int inf = 1010;

void chmin(int &a, int b){ 
  if( a > b ){ swap(a,b);}
  return ;
}

signed main(void){ 
  
  int h,w; cin >> h >> w;
  
  vector<vector<int>> dp(h,vector<int>(w,inf));
  dp[0][0] = 0;
    
  for(int i = 0; i < h; i++){ 
    for(int j = 0; j < w; j++){ 
      
      cin >> table[i][j];
      
    }
  }
  
  for(int i = 0; i < h; i++){ 
    for(int j = 0; j < w; j++){ 
      
      if( i < h-1 ){ 
        
        int c = ( table[i][j] == '.' && table[i+1][j] == '#' );
        
        chmin(dp[i+1][j],dp[i][j]+c);
        
      }
      
      if( j < w-1 ){ 
        
        int c = ( table[i][j] == '.' && table[i][j+1] == '#' );
        
        chmin(dp[i][j+1],dp[i][j]+c);
        
      }
      
    }
  }
  
  int d = (table[0][0] == '#' );
  
  cout << dp[h-1][w-1]+d << endl;
  
  return 0;
  
} 
    

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    int a, b; cin >> a >> b;
    if(b%a==0) cout << a+b << ln;
    else cout << b-a << ln;
}

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

int main(){
    ll n,ans=0; cin>>n;
    vector<ll> a(n);
    for(ll i=0; i<n; i++) cin>>a[i];
    for(ll i=1; i<n; i++) a[i] += a[i-1];
    ans = a[n-1];
    for(ll i=0; i<n-1; i++) {
        ans = min(ans, abs(a[n-1] - 2*a[i]));
    }
    cout<<ans;
}

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

using Int = __int128_t;
Int abs128(Int val){return val<0?-val:val;}

ostream &operator<<(ostream &os,Int val){
  if(ostream::sentry(os)){
    __uint128_t tmp=abs128(val);
    char buf[64];
    char *d=end(buf);
    do{
      --d;
      *d=char(tmp%10+'0');
      tmp/=10;
    }while(tmp);
    if(val<0) *--d='-';
    Int len=end(buf)-d;
    if(os.rdbuf()->sputn(d,len)!=len){
      os.setstate(ios_base::badbit);
    }
  }
  return os;
}

istream &operator>>(istream &is,Int &val){
  string s;
  is>>s;
  val=0;
  for(Int i=0;i<(Int)s.size();i++)
    if(isdigit(s[i])) val=val*10+s[i]-'0';
  if(s[0]=='-') val*=-1;
  return is;
}



signed main(){
  Int k,a,b;
  cin>>k>>a>>b;
  if(a>=k){
    cout<<1<<endl;
    return 0;
  }
  if(a<=b){
    cout<<-1<<endl;
    return 0;
  }
  Int l=0,r=1e22;
  while(l+1<r){
    Int m=(l+r)>>1;
    if((m+1)*a-m*b>=k) r=m;
    else l=m;
  }
  cout<<2*r+1<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>

using namespace std;


int main() {
	int i, j;
	int n, k;
	vector<int> v(200000);
	vector<int> v2(200000);
	map<int, int> mp;
	map<int, int>::iterator it;
	int nn;
	int cnt = 0;


	cin >> n >> k;

	for (i = 0; i < n; i++) {
		cin >> v[i];
		if (mp.count(v[i]) == 0) {
			mp.insert(pair<int, int>(v[i], 1));
		}
		else {
			mp[v[i]]++;
		}
	}

	if (mp.size() <= k) {
		cout << 0 << endl;
		goto label;
	}

	
	i = 0;
	for (it = mp.begin(); it != mp.end(); it++) {
		v2[i] = (*it).second;
		i++;
	}

	sort(v2.begin(), v2.end());

	i = std::count(v2.begin(), v2.end(),0);
	nn = i;

	for (i ; i < nn + mp.size() - k; i++) {
		cnt += v2[i];
	}

	cout << cnt << endl;








	label:


	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#define MN 2010

int h[MN], nxt[2 * MN], to[2 * MN], K = 0;
int f[MN], g[MN], siz[MN];
char s[MN]; int n;

void ins(int u, int v) {nxt[++K] = h[u]; h[u] = K; to[K] = v;}

void dfs(int x, int fa)
{
	siz[x] = (s[x] == '1');
	int Max = 0, id = -1;
	for(int i = h[x]; i; i = nxt[i])
	{
		if(to[i] == fa) continue;
		dfs(to[i], x);
		siz[x] += siz[to[i]];
		g[x] += g[to[i]] + siz[to[i]];
		if(f[to[i]] + siz[to[i]] > Max) id = to[i], Max = f[to[i]] + siz[to[i]];
	}
	int sum = 0;
	for(int i = h[x]; i; i = nxt[i])
	{
		if(to[i] == fa) continue;
		if(to[i] != id) sum += g[to[i]] + siz[to[i]];
	}
	if(sum >= Max) f[x] = g[x] & 1;
	else f[x] = Max - sum;
}

int main()
{
	scanf("%d%s", &n, s + 1);
	for(int i = 1; i < n; i++)
	{
		int a, b; scanf("%d%d", &a, &b);
		ins(a, b); ins(b, a);
	}
	
	int ans = 2e9;
	for(int i = 1; i <= n; i++)
	{
		memset(f, 0, sizeof(f));
		memset(g, 0, sizeof(g));
		dfs(i, 0);
		if(f[i] == 0) ans = std::min(ans, g[i] / 2);
	}
	if(ans >= 1e9) puts("-1");
	else printf("%d\n", ans);
}

Measured memory_bytes: 512
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);
        int m = Integer.parseInt(input[1]);
        int l = Integer.parseInt(input[2]);
        int[][] A = new int[n][m];
        int[][] B = new int[m][l];

        int i, j;
        for (i = 0; i < n; i++) {
            input = br.readLine().split(" ");
            for (j = 0; j < m; j++) {
                A[i][j] = Integer.parseInt(input[j]);
            }
        }
        for (i = 0; i < m; i++) {
            input = br.readLine().split(" ");
            for (j = 0; j < l; j++) {
                B[i][j] = Integer.parseInt(input[j]);
            }
        }

        int k;
        long sum;
        for (i = 0; i < n; i++) {
            for (j = 0; j < l; j++) {
                sum = 0;
                for (k = 0; k < m; k++) {
                    sum += A[i][k] * B[k][j];
                }
                System.out.print(sum + ((j == l - 1) ? "" : " "));
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 32580
i = 0
n = int(input())
for i in range(n):
    x, y, z = map(int, input().split())
    if x**2 + y**2 == z**2 or x**2 + z**2 == y**2 or y**2 + z**2 == x**2: 
        print('YES')
    
    else:
        print('NO')


Measured memory_bytes: 5596
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<=n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll N,M;
    cin>>N>>M;
    vector<ll> H(N);
    rep(i,N) cin>>H.at(i);
    
    vector<bool> Good(N);
    rep(i,N) Good.at(i)=true;
    
    rep(i,M){
        ll A,B;
        cin>>A>>B;
        A--;
        B--;
        if(H.at(A)<=H.at(B)) Good.at(A)=false;
        if(H.at(A)>=H.at(B)) Good.at(B)=false;
    }
    ll ans=0;
    rep(i,N) if(Good.at(i)) ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3988
#include<cstdio>
#include<iostream>
#include<vector>

using namespace std;

int N, K;
vector<bool> record(10, false);

int main() {
    scanf("%d%d", &N, &K);
    int num;
    for (int i = 0; i < K; i++) {
        cin >> num;
        record[num] = true;
    }
    for (int i = N;;i++) {
        int j = i;
        bool flag = true;
        while(0 < j) {
            if(record[j % 10]) {
                flag = false;
                break;
            }
            j /= 10;
        }
        if(flag) {
            num = i;
            break;
        }
    }

    printf("%d\n", num);
    return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>
int main(void){
    char a[100005];
    for(int i=0;i<100005;i++)a[i]='A';
    scanf("%s",a);
    int d;
    for(int i=0;i<100005;i++){
        if(a[i]!='A')d=i;
    }
    int ans1,ans2;
    ans1=0;ans2=0;
    for(int i=0;i<d;i++){
        if(i%2){
            if(a[i]=='0')ans1++;
        }
        else{
            if(a[i]=='1')ans1++;
        }
    }
    for(int i=0;i<d;i++){
        if(i%2){
            if(a[i]=='1')ans2++;
        }
        else{
            if(a[i]=='0')ans2++;
        }
    }
    if(ans2<ans1)ans1=ans2;
    printf("%d\n",ans1);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>; using vvi = vector<vector<int>>;
using vl = vector<ll>; using vvl = vector<vector<ll>>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
//#define int ll
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
struct edge{
  int to,wt,from;
  bool operator<(edge right){
    return wt < right.wt;
  }
};
using ve = vector<edge>;
using vve = vector<ve>;
struct union_find{//rank,経路圧縮で高速化
  vector<long long> data;//そのノードがrootであれば-（集合のサイズ）を表し、そうでなければ親ノードidを示す。
  union_find(long long size):data(size,-1){}//コンストラクタ,size個のノードを作成し、-1で初期化
  long long root(long long a){//根を探す,経路圧縮
    return data[a] < 0 ? a : data[a]=root(data[a]);
  }
  bool find(long long a,long long b){//a,bが同じ集合に属するか調べる
    return root(a) == root(b);
  }
  bool unite(long long a,long long b){//小さい方の木の根に大きい方の根を上書きする
    a = root(a),b = root(b);
    if(a==b) return false;//根が同じなら終了,uniteが失敗したことを出力
    if(data[a]<data[b]) swap(a,b); //集合サイズの大きい方の根に低い方の根をつける
    data[a] += data[b];//集合サイズを統合
    data[a] = b;//yの親にxをつける
    return true;//unite成功を出力
  }
  long long size(long long a){//aが属する集合のサイズを出力
    return -data[root(a)];
  }
};
int kruskal(int sz,ve &edges){
  sort(rALL(edges));
  union_find uf(sz);
  int res = 0;
  while(!edges.empty()){
    edge &e = edges.back();
    edges.pop_back();
    if(!uf.unite(e.to,e.from)) continue;
    res += e.wt;
  }
  return res;
}
signed main(){
  int v,e;
  while(cin >> v >> e,v){
    ve edges(e);
    REP(i,e){
      int nd1,nd2,wt;
      cin >> nd1 >> nd2 >> wt;
      edges[i]=(edge){nd1,wt,nd2};
    }
    cout << kruskal(v,edges) << endl;
  }
}


Measured memory_bytes: 3084
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll a[100100],fc[100100]={1ll},nv[100100]={1ll};

ll rwpw(ll a, ll p = MOD-2){
	ll ret = 1ll;
	while(p){
		if(p%2){
			mul_mod(ret,a);
		}
		mul_mod(a,a);
		p /= 2;
	}
	return ret;
}

ll c(int n, int k){
	ll ret;
	if(n<k){
		return 0ll;
	}
	ret = fc[n];
	mul_mod(ret,nv[k]);
	mul_mod(ret,nv[n-k]);
	return ret;
}

int main(void){
	int n,k,i;
	ll tmp,ans=0ll;
	cin >> n >> k;
	for(i=0; i<n; ++i){
		fc[i+1] = fc[i]*(i+1)%MOD;
		nv[i+1] = rwpw(fc[i+1]);
		cin >> a[i];
	}
	sort(a,a+n);
	for(i=0; i<n; ++i){
		if(a[i]<0ll){
			a[i] += MOD;
		}
		tmp = c(i,k-1);
		add_mod(tmp,MOD-c(n-i-1,k-1));
		mul_mod(tmp,a[i]);
		add_mod(ans,tmp);
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
  int n;
  cin >> n;
  for (int i = 0; i < n; i++){
    float x1, x2, x3, x4, y1, y2, y3, y4, a, b;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a = (y2 - y1) / (x2 - x1);
    b = (y4 - y3) / (x4 - x3);
    if (a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

Measured memory_bytes: 3000
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if len(str(i)) % 2 == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38896
import collections

K = int(input())
Q = collections.deque([i for i in range(1, 10)])
for _ in range(K):
  x = Q.popleft()
  r = x%10
  if r != 0: Q.append(x*10 + r - 1)
  Q.append(x*10 + r)
  if r != 9: Q.append(x*10 + r + 1)
print(x)

Measured memory_bytes: 11956
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    int x, y;
    scan(x, y);

    int ans;

    if (1L * x * y != 0) {
        if (0 < x && x < y) ans = y - x;
        else if (0 < y && y < x) ans = x - y + 2;
        else if (x < y && y < 0) ans = y - x;
        else if (y < x && x < 0) ans = x - y + 2;
        else if (x < 0 && 0 < y && abs(x) < abs(y)) ans = y + x + 1;
        else if (x < 0 && 0 < y && abs(x) == abs(y)) ans = 1;
        else if (x < 0 && 0 < y && abs(x) > abs(y)) ans = -y - x + 1;
        else if (y < 0 && 0 < x && abs(x) < abs(y)) ans = -y - x + 1;
        else if (y < 0 && 0 < x && abs(x) == abs(y)) ans = 1;
        else if (y < 0 && 0 < x && abs(x) > abs(y)) ans = y + x + 1;
    }
    else {
        if (x == 0) {
            ans = (y > 0 ? y : abs(y) + 1);
        }
        else {
            ans = (x > 0 ? x + 1 : abs(x));
        }
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > adj[100005];
bitset<100005> vis, col;

void dfs(int v) {
	vis[v]=true;
	for (int i=0; i<adj[v].size(); i++) {
		int nv = adj[v][i].first, w = adj[v][i].second;
		//printf("%d %d\n", nv, w);
		if (!vis[nv]) {
			col[nv] = (w%2 == 1) ^ (col[v]);
			//printf("%d\n", col[nv] ? 1 : 0);
			dfs(nv);
		}
	}
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i=0; i<n-1; i++) {
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		u--; v--;
		adj[u].push_back({v, w});
		adj[v].push_back({u, w});
	}
	dfs(0);
	for (int i=0; i<n; i++) {
		printf("%d\n", col[i] ? 1 : 0);
	}
}


Measured memory_bytes: 8064
#include<set>  
#include<map>  
#include<cmath>  
#include<cstdio>  
#include<queue>
#include<vector>  
#include<cstring>  
#include<climits>  
#include<iostream>  
#include<algorithm>  
using namespace std; 
#define INF 0x3f3f3f3f
#define MAXN 100000
int read(){  
	int f=1,x=0;  
    char c=getchar();  
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}  
    while('0'<=c&&c<='9') x=x*10+c-'0',c=getchar();  
    return f*x;  
}
int ans=INF,d;
map<int,int> Map;
void DFS(int *a,int t)
{
	if(t>d)return ;
	int tmp=100*(a[2]-a[0])+10*(a[1]-a[0]),num[3];
	if(Map.count(tmp)){ans=min(ans,t+Map[tmp]);return ;} 
	num[0]=a[0]+2,num[1]=a[1],num[2]=a[2];
	sort(num,num+3);
	DFS(num,t+1);
	if(num[2]-num[0]<=2)
	{
		num[0]=a[0]+1,num[1]=a[1]+1,num[2]=a[2];
		sort(num,num+3);
		DFS(num,t+1);
	}
	return ;
}
int main(){
	Map[22]=1,Map[202]=1,Map[220]=1;
	Map[1]=1,Map[10]=1,Map[100]=1;
	Map[2]=2,Map[20]=2,Map[200]=2;
	Map[12]=3,Map[21]=3,Map[102]=3,Map[120]=3,Map[210]=3,Map[201]=3;
	Map[0]=0;
	int a[3];
	a[0]=read(),a[1]=read(),a[2]=read();
	if(a[0]==a[1]&&a[1]==a[2]) {printf("0\n"); return 0;}
	sort(a,a+3);
	d=(2*a[2]-a[0]-a[1])/2+3;
	DFS(a,0);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

N, X = map(int, input().split())

l = [1]
p = [1]
for i in range(1, 51):
    l.append(2*l[i-1]+3)
    p.append(2*p[i-1]+1)


def L(i, X):
    if i == 0:
        if X == 0:
            return 0
        else:
            return 1
    else:
        if X == 0:
            return 0
        elif 1 <= X < l[i-1]+2:
            return L(i-1, X-1)
        elif X == l[i-1]+2:
            return p[i-1]+1
        elif l[i-1]+2 < X < l[i]:
            return p[i-1]+1+L(i-1, X-l[i-1]-2)
        else:
            return p[i]


print(L(N, X))


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define INF 1LL << 55
#define MAX (1LL << 31) -1
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;
typedef pair<pair<int,int>,ll> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};
//#define F function<T(T,T)>


signed main(){
    while(true){
        int n;
        cin>>n;
        if(n==0) return 0;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        sort(v.begin(),v.end());
        int ans=MAX;
        for(int i=0;i<n-1;i++){
            chmin(ans,v[i+1]-v[i]);
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3076
x = int(input())
primes = []
n = 2


def is_prime(num):
    for p in primes:
        if num % p == 0:
            return False
        if p * p > num:
            return True
    return True


while True:
    if is_prime(n):
        if n >= x:
            print(n)
            exit()
        else:
            primes.append(n)
    n += 1

Measured memory_bytes: 3392
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <vector>

#define REP(a, b) for (int a = 0; a < b; a++)
#define FORU(a, b, c) for (int a = b; a <= c; a++)
#define FORD(a, b, c) for (int a = b; a >= c; a--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;

int main() {
	int X, T;

	scanf("%d %d", &T, &X);

	printf("%.6lf\n", T / (double) X);

	return 0;	
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
  int n;
  cin >> n;
  if(n%2){
    cout << "No" << endl;
  }else{
  string s;
  cin >> s;
  if(s.substr(0,n/2)==s.substr(n/2,n/2)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  }
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, a[200000], s[200001];

LL f(int l, int i, int r) {
	LL P = s[l] - s[0];
	LL Q = s[i] - s[l];
	LL R = s[r] - s[i];
	LL S = s[n] - s[r];
	return max(max(max(P, Q), R), S) - min(min(min(P, Q), R), S);
}

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	
	inc(i, n) { s[i + 1] = s[i] + a[i]; }
	
	LL ans = 1e15;
	int l = 1, r = 3;
	incII(i, 2, n - 2) {
		while(l + 1 < i && s[l + 1] - s[0] <= s[i] - s[l + 1]) { l++; }
		while(r + 1 < n && s[r + 1] - s[i] <= s[n] - s[r + 1]) { r++; }
		if(l + 1 < i && s[l] - s[0] < s[i] - s[l + 1]) { l++; }
		if(r + 1 < n && s[r] - s[i] < s[n] - s[r + 1]) { r++; }
		LL P = s[l] - s[0];
		LL Q = s[i] - s[l];
		LL R = s[r] - s[i];
		LL S = s[n] - s[r];
		LL v = max(max(max(P, Q), R), S) - min(min(min(P, Q), R), S);
		setmin(ans, v);
		#define I << " " <<
		// cout << P I Q I R I S << endl;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int count=0;
  for(int i=1;i<=n;i++){
      int t=(n/i);
      count=count+t;
      if(n%i==0)
      count--;
  }
  cout<<count;
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long

bool sameparity(int a, int C)
{
	if((a % 2 == 0 && C % 2 == 0) ||
	(a % 2 == 1 && C % 2 == 1))
		return true;
	return false;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	int a, b, c;
	cin >> a >> b >> c;

	int C = c % b;
	for(int i = 0; i < b; ++i)
	{
		//cout << (a * i) % b << endl;
		if((a * i) % b == C){
			cout << "YES" << endl;
			exit(0);
		}
	}

	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int k;
    int a;
    int b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
        if(i%k==0)
        {
            cout<<"OK";
            return 0;
        }  
    cout<<"NG";
    return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
const int maxn=2e5+5;

int32_t main(){
    fast_io;
    int r,b,g;
    cin>>r>>g>>b;
    int k;
    cin>>k;
    int ans = 0;
    while(g <= r) g *= 2, ans++;
    while(b <= g) b *= 2, ans++;
    if(ans <= k) {
    	show("Yes");
    }
    else{
    	show("No");
    }
    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int r,d,x;
	int a[11]={0};
	cin>>r>>d>>x;
	a[0]=x;
	for(int i=1;i<=10; i++)
	{
		a[i]=(a[i-1]*r) -d;
	}
	for(int i=1; i<=10; i++)
		cout<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <random>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
#define fst	first
#define scn second
#define bicnt(x)	__buildin__popcount(x)
#define debug(x)	cout<<"debug: "<<x<<endl
#define DEBUG 0

const ll inf = (ll)1e9;
const ll mod = 998244353;
const ld eps = 1e-9;
const int dx[] = { 0,1,0,-1 };
const int dy[] = { 1,0,-1,0 };

ld pos[40000];
ld al[40000], ar[40000];

ll merge_sort(int l, int r) {
	int m = (l + r) / 2;
	ll ret = 0;
	if (l + 1 < m)	ret += merge_sort(l, m);
	if (m + 1 < r)	ret += merge_sort(m, r);
	int als = 0, ars = 0;
	srep(i, l, m)	al[als++] = pos[i];
	srep(i, m, r)	ar[ars++] = pos[i];
	int s = 0, t = 0;
	srep(i, l, r) {
		if (s == als)	pos[i] = ar[t++];
		else if (t == ars)	pos[i] = al[s++];
		else if (al[s] > ar[t]) {
			pos[i] = ar[t++];
			ret += als - s;
		}
		else	pos[i] = al[s++];
	}
	return ret;
}

vint a, b, c;
ld xline = inf, yline = inf;

ll check(ld mid, int n,ld line) {
	rep(j, n)	pos[j] = (c[j] - a[j] * mid) / b[j];
	ll leftp = merge_sort(0, n);
	rep(j, n)	pos[j] = (ld)-(c[j] - a[j] * mid) / b[j];
	ll rightp = merge_sort(0, n);
	if (line != inf) {
		if (line < mid)	leftp += n;
		else if (mid < line)	rightp += n;
	}
	return leftp - rightp;
}

int main() {
	int n;	cin >> n;
	vector<tuple<ld, int, int, int>> datx,daty;
	rep(i, n) {
		int a, b, c;	cin >> a >> b >> c;
		if (a == 0)	yline = (ld)c / b;
		else	daty.push_back(mt((ld)b / a, a, b, c));
		if (b == 0)	xline = (ld)c / a;
		else	datx.push_back(mt((ld)a / b, a, b, c));
	}
	sort(all(datx));	sort(all(daty));
	for (auto it : datx) {
		a.push_back(get<1>(it));
		b.push_back(get<2>(it));
		c.push_back(get<3>(it));
	}
	ld lx = -2e10, rx = 2e10;
	rep(i,100) {
		ld mid = (lx + rx) / 2;
		if (check(mid, datx.size(), xline) >= 0)	rx = mid;
		else lx = mid;
	}
	a.clear();	b.clear();	c.clear();
	ld x = (lx + rx) / 2;
	for (auto it : daty) {
		a.push_back(get<2>(it));
		b.push_back(get<1>(it));
		c.push_back(get<3>(it));
	}
	ld ly = -2e10, ry = 2e10;
	rep(i, 100) {
		ld mid = (ly + ry) / 2;
		if (check(mid, daty.size(), yline) >= 0)	ry = mid;
		else ly = mid;
	}
	ld y = (ly + ry) / 2;
	printf("%.15Lf %.15Lf\n", x, y);
	return 0;
}

Measured memory_bytes: 6884
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    double X;
    cin >> X;

    ll ans = 0;
    ll m = 100;
    while (true)
    {
        ans++;
        m *= 1.01;
        if (m >= X)
        {
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
int main()
{   int n,k=1;
    cin >> n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
     cin >> arr[i];
    if(arr[i] %2 ==0)
    {
        if (arr[i] %3==0 || arr[i] %5 ==0)
        k=1;
        else
        {
         k=0;
         break;
        }
    }
    }
    if(k==1)
    cout << "APPROVED" <<endl;
    else if (k==0)
    cout <<"DENIED" <<endl;
    return 0;
}

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

S = [input() for i in range(0,N)]

C0=0 #AC
C1=0 #WA
C2=0 #TLE
C3=0 #RE

for i in range(0,N):
    if S[i]=='AC':
        C0+=1
    elif S[i]=='WA':
        C1+=1
    elif S[i]=='TLE':
        C2+=1
    elif S[i]=='RE':
        C3+=1

print('AC x', C0)
print('WA x', C1)
print('TLE x', C2)
print('RE x', C3)

Measured memory_bytes: 16332
H, W = map(int, input().split())
N = input()
A = list(map(int, input().split()))

h, w = 0, 0
G = [[''] * W for i in range(H)]

for i, a in enumerate(A, start=1):
    for ai in range(a):
        G[h][w] = str(i)
        w += 1
        if w == W:
            h += 1
            w = 0

for i in range(H):
    if i % 2 == 0:
        print(' '.join(G[i]))
    else:
        print(' '.join(G[i][::-1]))


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
ll modpow(ll a, ll p) {
    if(p == 0)
        return 1;
    if(p % 2 == 0) {
        ll halfp = p / 2;
        ll half = modpow(a, halfp);
        return half * half % MOD;
    } else {
        return a * modpow(a, p - 1) % MOD;
    }
}

ll calcComb(ll a, ll b) {
    if(b < 0) {
        return 0;
    }
    if(a < 0) {
        return 0;
    }
    if(a < b) {
        return 0;
    }
    if(b > a - b) {
        return calcComb(a, a - b);
    }
    ll ansMul = 1;
    ll ansDiv = 1;
    REP(i, b) {
        ansMul *= (a - i);
        ansDiv *= (i + 1);
        ansMul %= MOD;
        ansDiv %= MOD;
    }
    ll ans = ansMul * modpow(ansDiv, MOD - 2);
    ans %= MOD;
    return ans;
}

int main() {
    int n, k;
    cin >> n >> k;
    int red = n - k;
    for(int i = 1; i <= k; i++) {
        long long res = calcComb(red + 1, i) * calcComb(k - 1, i - 1) % MOD;
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io;


fn main() {
    let n = read_one::<usize>();
    let an = read::<usize>();
    let mut l = vec![0; n + 1];
    let mut r = vec![0; n + 1];

    for i in 0..n {
        l[i + 1] = gcd(l[i], an[i]);
    }
    for i in (0..n).rev() {
        r[i] = gcd(r[i + 1], an[i]);
    }

    let ans = (0..n)
        .map(|i| gcd(l[i], r[i + 1]))
        .max()
        .unwrap();
    println!("{}", ans);
}

fn gcd(p: usize, q: usize) -> usize {
    if q == 0 { p }
    else { gcd(q, p % q) }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 8444
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    bit = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Measured memory_bytes: 49624
//        ★★ ASHWINI SHARMA ★★ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define debug(x) cout<<#x<<": "<<x<<endl
#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second 
 
 
#define PI 3.1415926535897932385
#define INF 1e18
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007
                                  //          ★★ ASHWINI SHARMA ★★      
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll exp(ll x, ll y, ll p)
{
    ll res = 1;   
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)    
            res = (res*x) % p;
        y = y>>1;     
        x = (x*x) % p; 
    }
    return res;
}

 
int main() {
    #ifdef sharma
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);      
    #endif
    fastio;
    int n;
    cin >> n;
    double x[n];
    double sum;
    rep(i, n)
    {
        cin >> x[i];
        //sum = sum+x[i]
    }
    sort(x, x+n);

    sum = (x[0]+x[1])/2.0;
    fr(i, 2, n-1)
    {
        sum = (sum+x[i])/2.0;
    }
    printf("%0.5f", sum);
    



    return 0; 
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

vector<int> prime(int n){
    vector<int> t;
    vector<bool> x(n+1, true);
    t.push_back(2);

    int i;
    for(i = 3; i * i <= n; i += 2){
        if(!x[i]){
            continue;
        }
        t.push_back(i);
        for(int j = i; j <= n; j += i){
            x[j] = false;
        }
    }
    for(; i <= n; i += 2){
        if(x[i]){
            t.push_back(i);
        }
    }
    return t;
}

signed main(){
    while(true){
        int n;
        cin >> n;

        if(n == 0){
            break;
        }

        if(n <= 2){
            cout << 1 << endl;
            continue;
        }

        vector<int> p = prime(n);
        vector<int> q = prime(n * 2);

        cout << q.size() - p.size() << endl;
    }

    return 0;
}



Measured memory_bytes: 3564
//ITNOA
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;


#define rep(i, s, e) for(int i = s; i < e; i ++)
#define int long long
#define X first
#define Y second

typedef long long ll;
typedef long double ld;

const int maxN = 100*1000 + 5;
const int mod = 1000*1000*1000 + 7;
const int base = 701;
const int SQ = 500;
const int maxL = 20;


int a[maxN];
int32_t main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n, k; cin >> n >> k;
	for(int i = 0; i < n; i ++)
		cin >> a[i];
	int gc = a[0];
	for(int i = 0; i < n; i ++)
		gc = __gcd(gc, a[i]);

	if(*max_element(a,a+n) >= k && k % gc == 0)
		cout << "POSSIBLE" << endl;
	else 
		cout << "IMPOSSIBLE" << endl;
	return 0;
}


Measured memory_bytes: 1152