akhauriyash/Code-Regression huggingface dataset:
// ---------- BEG ../defs.hpp BEG ----------
#ifndef atcoder_defs_hpp
#define atcoder_defs_hpp
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
using i8t = std::int64_t;
using u8t = std::uint64_t;
using vi8t = std::vector<i8t>;
using vvi8t = std::vector<std::vector<i8t>>;
using vu8t = std::vector<u8t>;
#include <limits>
static const i8t i8t_max=numeric_limits<i8t>::max();
static const i8t i8t_min=numeric_limits<i8t>::min();
#include <unordered_map>
#include <unordered_set>
template<typename Key,typename Value> using map_t=std::unordered_map<Key, Value>;
template<typename Key> using set_t=std::unordered_set<Key>;
#define F3(i,i0,iN,step) for(i8t i=i0,i##_N=iN;i<i##_N;i+=step)
#define F2(i,i0,iN) F3(i,i0,iN,1)
#define F(i,N) F3(i,0,N,1)
#define FR(i,N) for(i8t i=N;i--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
template<typename T> T umax(T& ans,T const& value) {if(value>ans)ans=value;return ans;}
template<typename T> T umin(T& ans,T const& value) {if(value<ans)ans=value;return ans;}
template<typename T> struct identity { using type = T; };
#endif
// ---------- END ../defs.hpp END ----------

int main() {
  R(N)R(P)RL(dummy);RL(S);

  i8t ans=0;
  if(P==2){
    F(i,N)if((S[i]-'0')%2==0)ans+=i+1;
  }else if(P==5){
    F(i,N)if((S[i]-'0')%5==0)ans+=i+1;
  }else{
    vi8t cnt(P,0);

    i8t s=0;
    cnt[s]++;

    i8t unit=1;
    FR(i,N){
      s+=unit*(S[i] - '0');
      s%=P;
      cnt[s]++;
      unit*=10;
      unit%=P;
    }

    F(s,P)ans+=cnt[s]*(cnt[s]-1)/2;
  }
  P(ans);
  return 0;
}


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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl			"\n"

int32_t main(){
	
	unsigned long long  n, k, mn;
	cin>>n>>k;

	if(n >= k)
		mn = n % k;

	else
		mn = n;

	mn = min(mn, k - mn);

	cout<<mn;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>
#include <algorithm>
#include<iomanip>
#include<map>
#define INF 1000000000
#define LM 55555
#define LL long long
using namespace::std;

LL N,M,K,ans,num,H,W,A[1001],B[1001];
string S;


int main() {
	cin >> N>>H>>W;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
		if (A[i] >= H&&B[i] >= W) {
			ans++;
		}
	}
	

	cout << ans << endl;
	return 0;
	

	
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0;i < N;i++) {
    cin >> vec.at(i);
  }
  int answer;
  for(int j = 0;j < N;j++) {
    if(j + 1 == vec.at(vec.at(j) - 1)) {
      answer++;
    }
  }
  cout << answer / 2 << endl;
}

Measured memory_bytes: 640
n=int(input())
words=[]
for i in range(n):
  words.append(input())
  
s=words.pop()
for i in words:
  ns=""
  l=list(i)
  for j in s:
    if j in l:
      ns+=j
      l.remove(j)
  s=ns
s=sorted(list(s))
out=""
for i in s:
  out+=i
print(out)

Measured memory_bytes: 9204
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>

#define ll long long
#define ld long double

using namespace std;

ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
ll ans = 0, mx = 0, mn = 1e9, sum = 0, cnt = 0, avr = 0, index = -1;

//map<char, int>freq;
vector<int>vec;
vector<int>freq(10000 + 5, 0);
vector<int>cFreq(150, 0);

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

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

n, q = [int(i) for i in readline().split()]
to = [[] for _ in range(n)]
ans = [0]*n

def dfs(v, p=-1): # v:これから見るnode、p:親node
    global ans
    for i in range(len(to[v])):
        u = to[v][i]
        if u == p: continue # 親nodeは確認済みなので見ない
        ans[u] += ans[v]
        dfs(u, v)

for i in range(n-1):
    a, b = [int(i) for i in readline().split()]
    a -= 1; b -= 1
    to[a].append(b)
    to[b].append(a)

for i in range(q):
    v, x = [int(i) for i in readline().split()]
    v -= 1
    ans[v] += x

dfs(0)

print(*ans)

Measured memory_bytes: 266792
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n;
double t, a;
double h[1010];
int main() {
    cin>>n>>t>>a;
    REP(i, 0, n) cin>>h[i];

    ll ans;
    double diff=(double)inf;
    REP(i, 0, n){
        double temp=t-(0.006*h[i]);
        if(abs(temp-a) < diff){
            diff=abs(temp-a);
            ans=i+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
double prob(int x,int k);
double sum=0;
int main()
{
    int n,k,i;
    scanf("%d %d",&n,&k);
    for(i=1;i<=n;i++){
        sum+=(prob(i,k))/n;
    }
    printf("%.12f",sum);
}
double prob(int x,int k)
{
    if(x>=k)
        return 1;
    return prob(x*2,k)/2.0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
	
	private void run(){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		while(n != 0){
			//サイコロの面を記録する
			//0：上、1：北、2：東、3：南、4：西、5：下
			int[] dice = {1, 5, 3, 2, 4, 6};
			int total = 1;
			String command;
			for (int i = 0; i < n; i++) {
				command = scan.next();
				if (command.equals("North")) {
					this.north(dice);
				}else if (command.equals("East")) {
					this.east(dice);
				}else if (command.equals("West")) {
					this.west(dice);
				}else if (command.equals("South")) {
					this.south(dice);
				}else if (command.equals("Right")) {
					this.right(dice);
				}else if (command.equals("Left")) {
					this.left(dice);
				}
				total += dice[0];
			}
			System.out.println(total);
			n = scan.nextInt();
		}
		
	}
	
	public void north(int[] dice){
		int temp = dice[0];
		dice[0] = dice[3];
		dice[3] = dice[5];
		dice[5] = dice[1];
		dice[1] = temp;
	}
	
	public void east(int[] dice){
		int temp = dice[0];
		dice[0] = dice[4];
		dice[4] = dice[5];
		dice[5] = dice[2];
		dice[2] = temp;
	}
	
	public void west(int[] dice){
		int temp = dice[0];
		dice[0] = dice[2];
		dice[2] = dice[5];
		dice[5] = dice[4];
		dice[4] = temp;
	}
	
	public void south(int[] dice){
		int temp = dice[0];
		dice[0] = dice[1];
		dice[1] = dice[5];
		dice[5] = dice[3];
		dice[3] = temp;
	}
	
	public void right(int[] dice){
		int temp = dice[3];
		dice[3] = dice[2];
		dice[2] = dice[1];
		dice[1] = dice[4];
		dice[4] = temp;
	}
	
	public void left(int[] dice){
		int temp = dice[3];
		dice[3] = dice[4];
		dice[4] = dice[1];
		dice[1] = dice[2];
		dice[2] = temp;
	}

}

Measured memory_bytes: 25544
x,y =[int(x) for x in input().split()]

t = (y - 2*x)

if t >=0 and t%2 == 0 and x - t//2 >=0 :
    print('Yes')
else:
    print('No')

# y = 4*t + 2*(x - t)
# y = 2*t + 2 *x
# t = (y - 2*x)//2
# t >= 0 and t integer

# x = t + c

# y = 4*t + 2*(x - t)
# y = 2*t + 2*x
# 2*t = y - 2*x

# and c = x - t


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

using namespace std;
static const int INF = 1e9;

long int merge(vector<int>& A, int l, int mid, int r)
{
	int n1 = mid - l;
	int n2 = r - mid;
	vector<int> B(n1 + 1);
	for (int i = 0; i < n1; ++i)
	{
		B[i] = A[l + i];
	}
	B[n1] = INF;
	vector<int> C(n2 + 1);
	for (int i = 0; i < n2; ++i)
	{
		C[i] = A[mid + i];
	}
	C[n2] = INF;
	int posB = 0;
	int posC = 0;
	long int sum = 0;
	for (int i = l; i < r; ++i)
	{
		if (B[posB] <= C[posC])
		{
			A[i] = B[posB];
			++posB;
		}
		else
		{
			A[i] = C[posC];
			++posC;
			sum += n1 - posB;
		}
	}
	return(sum);
}

long int mergeSort(vector<int>& A, int l, int r)
{
	if (l + 1 < r)
	{
		long int v1, v2, v3;
		int mid = (l + r) / 2;
		v1 = mergeSort(A, l, mid);
		v2 = mergeSort(A, mid, r);
		v3 = merge(A, l, mid, r);
		return(v1 + v2 + v3);
	}
	else
	{
		return(0);
	}
}

void solve()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> A[i];
	}
	cout << mergeSort(A, 0, n) << endl;
}

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

Measured memory_bytes: 2584
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long A, B, K;
  cin >> A >> B >> K;
  if(A-K>0){
    A = A-K;
    K=0;
  }else{
    K = K - A;
    A = 0;
    B = (B-K>0)? B-K : 0;
  }
  cout << A << ' ' << B;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BRollerCoaster solver = new BRollerCoaster();
        solver.solve(1, in, out);
        out.close();
    }

    static class BRollerCoaster {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            long k = in.scanLong();
            long arr[] = new long[n];
            in.scanLong(arr);
            int ans = 0;
            for (long t : arr) if (t >= k) ans++;
            out.println(ans);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        public void scanLong(long[] A) {
            for (int i = 0; i < A.length; i++) A[i] = scanLong();
        }

    }
}



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

int main() {
    int N, K;
    int tmp = 1;
    cin >> N >> K;
    int cnt;
    while (tmp < K && cnt < N)
    {
        tmp += tmp;
        cnt++;
    }
    while (cnt < N){
        tmp += K;
        cnt++;
    }
    cout << tmp << endl;
}


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

using namespace std ;
typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<ll,ll> pll ;
typedef vector<pii> vpii ;
typedef vector<pll> vpll ;

#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(v) (v).begin(),(v).end()
#define MOD 1000000007
#define CHI 1000000000000000003
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define NP next_permutation
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}
//-----------------------------------------




















//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w ;
  cin >> h >> w ;
  REP(i,h){
    REP(j,w){
      str s ;
      cin >> s ;
      if(s=="snuke"){
        cout << (char)('A'+j)<<i+1 <<endl ;
        return 0 ;
      }
    }
  }
  
  
  
  return 0 ;
}

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

int main() {
    int N;
    cin >> N;
    vector<char> S(N);
    rep(i, N) cin >> S.at(i);

    set<char> hinaArare;
    rep(i, N) {
        hinaArare.insert(S.at(i));
    }
    string ans = (hinaArare.size() == 3) ? "Three" : "Four";

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const int TLE = 1000000;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    if(n == 1) cout << "Hello World" << endl;
    else{
        int a, b; cin >> a >> b;
        cout << a + b << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int h,w;
  char c[110][110];
  scanf("%d %d",&h,&w);
  for(int i=0;i<h;i++){
    scanf("%s",c[i]);
  }

  for(int i=0;i<h;i++){
    printf("%s\n",c[i]);
    printf("%s\n",c[i]);
  }
  return 0;
}


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


int main() {
    long long int W, H, x, y;
    std::cin >> W >> H >> x >> y;

    std::cout << double(W * H) / 2.0;

    if (x * 2 == W && y * 2 == H) {
        std::cout << " 1" << std::endl;
    } else {
        std::cout << " 0" << std::endl;
    }
}


Measured memory_bytes: 3736
import sys
input = sys.stdin.readline

def main():
    N,K = map(int,input().split())
    h = [int(input()) for _ in range(N)]
    h.sort()
    
    ans = 10**10
    for i in range(N-K+1):
        ans = min(ans,h[K+i-1]-h[i])
        
    print(ans)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 7384
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1000000 + 5;
const int MOD = int(1e9) + 7;

int n, m;
long long x;
int p[N];
int type[N];
pair<int, pair<int, int>> e[N];
vector<pair<int, int>> adj[N];

long long mod_pow(long long a, long long p)
{
    long long ret = 1;
    for ( ; p; p /= 2) {
        if (p & 1) {
            ret = ret * a % MOD;
        }
        a = a * a % MOD;
    }
    return ret;
}

int getp(int u)
{
    return u == p[u] ? u: p[u] = getp(p[u]);
}

int find_max(int u, int f, int g, int &maxw)
{
    if (u == g) return true;

    for (auto e : adj[u]) {
        int v = e.first;
        if (v == f) continue;
        if (find_max(v, u, g, maxw)) {
            maxw = max(maxw, e.second);
            return true;
        }
    }
    return false;
}

void solve()
{
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++) {
        p[i] = i;
    }
    for (int i = 0; i < m; i++) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        e[i] = make_pair(w, make_pair(u - 1, v - 1));
    }
    sort(e, e + m);
    long long cost = 0;
    int con = n;
    int could = m;

    for (int i = 0, j; i < m; i = j) {
        for (j = i; j < m && e[j].first == e[i].first; j++);
        for (int k = i; k < j; k++) {
            int pu = getp(e[k].second.first);
            int pv = getp(e[k].second.second);
            if (pu == pv) {
                type[k] = 1;
                could --;
            }
        }
        for (int k = i; k < j; k++) {
            int u = e[k].second.first;
            int v = e[k].second.second;
            int pu = getp(u);
            int pv = getp(v);
            if (pu != pv) {
                p[pu] = pv;
                cost += e[k].first;
                con --;
                adj[u].push_back(make_pair(v, e[k].first));
                adj[v].push_back(make_pair(u, e[k].first));
            }
        }
    }

    if (con != 1 || n < 3) {
        cout << 0 << endl;
        return;
    }

    if (cost == x) {
        cout << (mod_pow(2, could) - 2 + MOD) * mod_pow(2, m - could) % MOD << endl;
        return;
    } else {
        for(int i = 0; i < m; i++) {
            if (type[i]) {
                int w = 0;
                find_max(e[i].second.first, -1, e[i].second.second, w);
                if (cost - w + e[i].first < x) {
                    could ++;
                } else if (cost - w + e[i].first == x) {
                    type[i] = 2;
                }
            }
        }
    }

    long long ans = 0;
    for (int i = 0; i < m; i++) {
        if (type[i] == 2) {
            ans += mod_pow(2, m - could) % MOD;
            could ++;
        }
    }
    cout << ans % MOD << endl;
}

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



Measured memory_bytes: 29056
if __name__ == "__main__":
    K, N = map(int, input().split())
    A = list(map(int, input().split()))
    # print(A)
    A_dif = []
    for i in range(len(A)-1):
        # print(A[i + 1])
        # print(A[i])
        A_dif.append(A[i + 1] - A[i])
    A_dif.append((abs(K - A[-1]) + A[0]))
    # print(A_dif)
    A_dif.sort(reverse=True)
    ret = sum(A_dif[1:])
    print(ret)


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

#define ll long long 
int main() {
  int N;
  cin >> N;
  
  ll A[N];
  
  int minus = 0;
  ll absmin = 1000000000;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    ans += abs(A[i]);
    if (A[i] < 0)
      minus++;
    if (abs(A[i]) < absmin) absmin = abs(A[i]);
  }
  
  if (minus % 2) {
    cout << ans - 2 * absmin << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

ll gcd(ll a, ll b) {
  //cout << "gcd" << a << b << endl;
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  a %= b;
  return gcd(b, a);
}

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

  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  ll ming = 1;
  ll twopow = 1;
  ll ac = a[0];
  while (a[0] % 2 == 0) {
    a[0] /= 2;
    twopow *= 2;
  }
  ming *= ac / 2;
  if (ming > m) {
    cout << 0 << endl;
    return 0;
  }

  for (int i = 1; i < n; i++) {
    ac = a[i];
    if (a[i] % twopow != 0) {
      cout << 0 << endl;
      return 0;
    }
    a[i] /= twopow;
    if (a[i] % 2 == 0) {
      cout << 0 << endl;
      return 0;
    }
    //以下2で割れる回数は同じことが保証される
    ming = (ming *  (ac / 2)) / gcd(ming, ac / 2);
    if (ming > m) {
      cout << 0 << endl;
      return 0;
    }
  }

  //cout << ming << endl;

  cout << 1 + ((m - ming) / (2 * ming)) << endl;
}

Measured memory_bytes: 1024
#include <cstdio>

int main(){
   int a, b;
   scanf("%d %d", &a, &b);
   if(a<b){
     printf("a < b\n");
   }
   else if(a>b){
     printf("a > b\n");
   }
   else{
     printf("a == b\n");
   }
   return 0;
 }

Measured memory_bytes: 2604
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

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

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

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

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


int main() {
    int n, d; cin >> n >> d;
    cout << ((n + 2 * d) / (2 * d + 1)) << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  for(int i = s[1]; i > 0; i--){
    int x = 0;
    for(int j = 0; j < n; j++){
      if(s[j]%i != 0){
        x++;
      }
    }
    if(x == 1 || x == 0){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> d(n);
  for(int i=0;i<n;i++)
    cin>>d.at(i);
  sort(d.begin(),d.end());
  cout<<d.at(n/2)-d.at(n/2-1)<<endl;
}

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

/*                        [Template]                        */
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
#define _matrix(T) vector<vector<T>>
template<class T>
auto matrix( int r, int c, T v ){
	return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
const int mod = (int)1e9 + 7 ;
/************************************************************/
int cuts( int &x, int &s ){
    if( x % s == 0 ){
        return ( x / s - 1 ) ;
    }
    else return ( x / s ) ;
}

bool check( vector<int> &a, int &mid, int &k ){
    int len = a.size() ;
    int res = 0 ;
    for( int i = 0 ; i < len ; i++ ){
        res += cuts( a[i], mid ) ;
    }
    if( res > k ) return false ; // go below 
    else return true ;  // go ahead  
}

signed main(){
    int N, K ; cin >> N >> K ;
    vector<int> A(N) ;
    for( int i = 0 ; i < N ; i++ ) cin >> A[i] ;
    int low = 1, high = (int)2e9 ;
    int mid ;
    while( high - low + 1 >= 2 ) {
        mid = low + ( high - low ) / 2 ;
        // cout << mid << endl ;
        if( check(A, mid, K) ){
            high = mid ;
        }
        else{
            low = mid + 1 ;
        }
    }
    cout << low ;
    return 0 ;   
}

Measured memory_bytes: 4832
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

vector<pll>ad[2000005];
char mat[1005][1005];
ll dist[2000005];
bool gone[2000005];
int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m,sx,sy,dx,dy;

	cin >> n >> m;
	cin >> sx >> sy;
	cin >> dx >> dy;

	sx--,sy--,dx--,dy--;

	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
			cin >> mat[i][j];
	}

	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			dist[i*m+j]=-1;
			if(mat[i][j]=='#')
				continue;

			for(k=i-2;k<=i+2;k++)
			{
				for(t=j-2;t<=j+2;t++)
				{
					if( (k==i && t==j) || t<0 || t>=m || k<0 || k>=n || mat[k][t]=='#')
						continue;

					x=i*m+j;
					y=k*m+t;
					ll d=1;

					if( (t==j-1 && k==i) || (t==j+1 && k==i) || (t==j && k==i+1) || (t==j && k==i-1))
						d=0;

					ad[x].pb({y,d});
				}
			}
		}		
	}

	ll source = sx*m+sy , dest = dx*m+dy;

	set<pll>s;
	s.insert({0,source});
	ll tot=0;
	while(sz(s))
	{

		auto p = *(s.begin());
		x=p.ss,y=p.ff;
		s.erase(s.begin());
		
		if(gone[x])
			continue;

		gone[x]=true,tot++,dist[x]=y;
		for(auto it:ad[x])
		{
			if(!gone[it.ff])
				s.insert({it.ss+y,it.ff});
		}
	}

	if(dist[dest]==-1)
		cout<<-1<<endl;
	else
		cout<<dist[dest]<<endl;
}

Measured memory_bytes: 192780
ans = "TLE"
n, t = map(int, raw_input().strip().split())
tans = t + 1
cans = 1000000
for _ in xrange(n):
  ci, ti = map(int, raw_input().strip().split())
  if ti <= t:
    tans = ti
    cans = min(ci, cans)
if tans > t: print ans
else: print cans


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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
#define BIG(c) (c)-0x20
#define SMALL(c) (c)+0x20
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int N;
      cin >> N;
      bitset<20> test(0);
      for(int i = 0;i < N;i++){
          int hat;
          cin >> hat;
          bitset<20> dummy(hat);
          test = test ^ dummy;
      }
      
      for(int i = 0;i < 20;i++){
          if(test[i]){
              cout << "No" << endl;
              return 0;
          }
      }
      cout << "Yes" << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

char C[2000];

bool check(int n, int p,int maxi, map<char,int> m){
    int cnt = 0;
    for(auto it:m){
        if(it.second + n - p > maxi) cnt++;
    }
    return (cnt == 1);
}

int main(){
    int n;
    while(cin >> n,n){
        map<char,int> m;
        bool f = false;
        int maxi = 0;
        char maxi_c;
        m['1'] = 0; //????£???????????????\???????????¨??????
        rep(i,n) cin >> C[i];
        rep(i,n){
            m[C[i]]++;
            if(maxi < m[C[i]]){
                maxi = m[C[i]];
                maxi_c = C[i];
            }
            if(check(n,i,maxi,m)){
                cout << maxi_c << ' ' << i + 1 << endl;
                f = true;
                break;
            }
        }
        if(not f){
            cout << "TIE" << endl;
        }
    }
}

Measured memory_bytes: 3080
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
char s[max_n];
int n;
int main(){
    scanf("%d %s",&n,s+1);
    int ans=0;
    for(int i=1;i+2<=n;i++){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int d, n;
  cin >> d >> n;
  int nn = 0;
  for(int i=1; i<10000000; i++){
    int cnt=0;
    int x = i;
    while(x%100 == 0){
      x /= 100;
      cnt++;
    }
    if(cnt==d){
      nn++;
      if(nn==n){
        cout << i << endl;
        return 0;
      }
    }
  }
}

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

int main() {

     int A;
    string S;
    
    cin >> A;
    cin >> S;
    
    if (A >= 3200) {
        cout << S << endl;
    }
    
    if (A < 3200) {
        cout << "red" << endl;
    }
    
 }

Measured memory_bytes: 256
a, b, m  =  map(int,input().split())
a_price = list(map(int,input().split()))
b_price = list(map(int,input().split()))
coupon = []
for i  in range(m):
    coupon.append(list(map(int,input().split())))
    # 例：[[1, 1, 5], [1, 1, 10]]


def get_min(a_price, b_price, coupon):
    minprice= min(a_price)+min(b_price)
    for k in range(m):
        aindex  = coupon[k][0]-1
        bindex  = coupon[k][1]-1
        sale = coupon[k][2]
        price = a_price[aindex]+b_price[bindex]-sale
        if price < minprice:
            minprice = price
    return minprice

print(get_min(a_price, b_price, coupon))



Measured memory_bytes: 38564
import java.util.*;

public class Main{
	
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      if(a==0){
        System.out.println("1");
      }else if(a==1){
        System.out.println("0");     
      }
    }
}

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

#define ll long long

ll a[100005], k, n;

ll ans=INT_MAX;

ll dp[100005];

int main()
{
	cin >> n;

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

	for(int i=0;i<100001;i++)
		dp[i]=1e9;

	dp[0]=0;
	dp[1]= abs(a[1]-a[0]);
	dp[2]= min(dp[2-1]+abs(a[2]-a[1]),dp[0]+abs(a[2]-a[0]));

	for(int i=3;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
	}

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

	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

// 蟻本でみた、ローリングハッシュを試してみる
vector<bool> check_eq(string s, string t) {
  int s_size = s.size();
  int t_size = t.size();
  vector<bool> result(s_size - t_size + 1);
  // modは2**64だと簡単に衝突する。また、複数用意して衝突しづらくする
  // http://hos.ac/blog/#blog0003 より
  vector<uint64_t> mods{1000000007, 999999937}; //modは素数。2乗してもオーバーフローしない数で
  uint64_t b = 10007;
  vector<uint64_t> bns(mods.size(), 1);
  vector<uint64_t> s_hash(mods.size(), 0);
  vector<uint64_t> t_hash(mods.size(), 0);
  int m_size = mods.size();
  
  for (int i = 0; i < t_size; i++) {
    for(int j = 0; j < m_size; j++) {
      const auto& m = mods[j];
      bns[j] = (bns[j] * b) % m;
    }
  }
  
  int i = 0;
  for(; i < t_size; i++) {
    for(int j = 0; j < m_size; j++) {
      const auto& m = mods[j];
      t_hash[j] = ((t_hash[j] * b) % m + t[i]) % m;
      s_hash[j] = ((s_hash[j] * b) % m + s[i]) % m;
    }
  }
  
  for(;;i++) {
    bool current_result = true;
    for(int j = 0; j < m_size; j++) {
      current_result &= s_hash[j] == t_hash[j];
    }

    result[i - t_size] = current_result;
    
    if (i >= s_size) {
      break;
    }

    for(int j = 0; j < m_size; j++) {
      const auto& m = mods[j];
      s_hash[j] = ((s_hash[j] * b) % m + s[i] - (s[i - t_size] * bns[j]) % m + m /*マイナスにならないようにmたす*/) % m;
    }
  }
  
  return result;
}

int main() {
  string s,t,s_origin;
  cin >> s >> t;
  s_origin = s;
  int s_origin_size = s_origin.size();
  int t_size = t.size();
  
  while(s.size() < t_size + s_origin_size) {
    s += s_origin;
  }
  
  vector<bool> eqs = check_eq(s,t);
  
  int max_length = 0;
  vector<int> length(s_origin_size, -1);

  for (int i = 0; i < s_origin_size; i++) {
    if (length[i] != -1) {
      continue;
    }

    if (!eqs[i]) {
      length[i] = 0;
      continue;
    }

    int current = i;
    int diff = 0;
    queue<int> q;
    while(eqs[current]) {
      if (!q.empty() && i == current) {
        // 無限に一致する
        max_length = -1;
        goto finish;
      }

      if (length[current] != -1) {
        diff = length[current]; // すでに到達済みの場合、計算済みの長さを加えて終了する
        break;
      }
      length[current] = 0; // 一旦到達マーク設定
      q.push(current);
      current = (current + t_size) % s_origin_size;
    }

    max_length = max(max_length, diff + (int)q.size());

    while(!q.empty()) {
      int len = q.size();
      int current = q.front();
      q.pop();
      length[current] = len + diff; // 正確な長さで上書き
    }
  }

finish:
  cout << max_length << endl;
  
  return 0;
}


Measured memory_bytes: 6776
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;

    string s;
    cin>>s;
    
    n=s.size();
  
     if(n%2==0){
     cout<<"No";
     return 0;
    }
  
    
    string s1=s;
    //cout<<s1;
    reverse(s1.begin(),s1.end());
    int flag=0;
    if(s==s1){
    flag=1;
    }
    int x=(n-1)/2;
    //cout<<x<<endl;
    int y=(n+3)/2;
    //cout<<y<<endl;
    string s2=s.substr(0,x);
   // cout<<s2<<endl;
    string s3=s.substr(y-1);
    //cout<<s3<<endl;
        
        string s4=s2;
        string s5=s3;
        
        reverse(s4.begin(),s4.end());
      //  cout<<s4;
        
        reverse(s5.begin(),s5.end());
        //cout<<s5;
            
    if(flag==1){
        if(s2==s4 && s3==s5){
            cout<<"Yes";
            return 0;
        }
        
        else{
            cout<<"No";
            return 0;
        }
    }
    else{
        cout<<"No";
        return 0;
    }

   // cout<<flag;    
    return 0;
}


Measured memory_bytes: 256
import itertools
N = int(input())
First_List = list(map(int,input().split()))
Second_List = list(map(int,input().split()))
Num_List = sorted(First_List)
F_Flg = 0
S_Flg = 0
Loop_Num = 1
for Sorted_Pair in itertools.permutations(Num_List, N):
    Search_Pair = list(Sorted_Pair)
    if (Search_Pair == First_List) & (F_Flg == 0):
        F_Flg = Loop_Num
    if (Search_Pair == Second_List) & (S_Flg == 0):
        S_Flg = Loop_Num
    
    if (F_Flg != 0) & (S_Flg != 0):
        break
    else:
        Loop_Num += 1

print(abs(F_Flg-S_Flg))

Measured memory_bytes: 9116
#include<stdio.h>
int main(void)
{
    int a, b;
    
    scanf("%d", &a);
    scanf("%d", &b);

    if(a < b)      printf("a < b\n");
    else if(a > b) printf("a > b\n");
    else           printf("a == b\n");

    return 0;
}


Measured memory_bytes: 2148
use std::io::*;
use std::str::FromStr;

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let mut bingo: Vec<i64> = vec![];
    for _ in 0..9 {
        let a: i64 = read();
        bingo.push(a);
    }

    let mut check: Vec<Vec<bool>> = vec![vec![false; 3]; 3];
    let n: i64 = read();
    for _ in 0..n {
        let c: i64 = read();
        match bingo.iter().position(|&x| x == c) {
            Some(s) => {
                check[s / 3][s % 3] = true;
            }
            None => {}
        }
    }
    let mut ans = "No";

    // vertical
    for i in 0..3 {
        if check[i][0] && check[i][1] && check[i][2] {
            ans = "Yes"
        }
    }

    // horizontal
    for i in 0..3 {
        if check[1][i] && check [0][i] && check[2][i] {
            ans = "Yes"
        }
    }

    if check[1][1] && check[0][0] && check[2][2] {
        ans = "Yes"
    }

    if check[0][2] && check[1][1] && check[2][0] {
        ans = "Yes";
    }
    println!("{}", ans);
    
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main( ) {
    //freopen("A.01.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if (a+b<c+d){
        cout << "Right" << endl;
    }
    else if(a+b>c+d){
        cout << "Left" << endl;
    }
    else {
        cout << "Balanced" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    ios_base::sync_with_stdio(false);
    int n,m;
    while(cin>>n>>m){
        vector<int> digit(n+1,0);
        digit[1]=1;
        if(n == 1)digit[1]=0;
        vector<bool> chng(n+1,0);
        bool fail = false;
        for(int i = 0; i < m; i++){
            int c,s;
            cin>>s>>c;
            if(chng[s]&&digit[s]!=c){
                fail = true;
            }
            else{
                chng[s]=true;
                digit[s]=c;
            }
        }
        if(digit[1]==0&&n!=1){
            fail = true;
        }
        if(fail){
            cout<<"-1\n";
        }
        else{
            for(int i = 1; i <=n; i++){
                cout<<digit[i];
            }
            cout<<'\n';
        }
    }
}

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

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int v[] = new int[N];

		for(int i = 0; i < N; i++) {
			v[i] = scan.nextInt();
		}

		Arrays.sort(v);

		double ans = v[0];

		for(int i = 1; i < N; i++) {
			ans = (ans + v[i])/2;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 23248
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;


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

    ll ans;
    if(a%2 == 0 || b%2 == 0 || c%2 == 0) ans = 0;
    else{
        ans = min({a*b, b*c, c*a});
    }

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        long N = in.l();
        long min = Long.MAX_VALUE;
        for (int i = 0; i < 5; i++) {
            min = Math.min(min, in.l());
        }
        long ans = (N - 1) / min + 5;
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = read(cbuf, 0, cbuf.length);
            } catch (IOException e) {}
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (c != ' ' && c != '\n' && c != '\r') {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (true) {
            char c = next();
            if (c != ' ' && c != '\n' && c != '\r') {
                back();
                break;
            }
        }
    }

    char[] s(final int N) {
        skip();
        char[] s = new char[N];
        for (int i = 0; i < s.length; i++) {
            s[i] = next();
        }
        return s;
    }

    String s() {
        try {
            return readLine();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


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

using namespace std;

int main() {
  cout << fixed << setprecision(10);
  int a, b, x;
  cin >> a >> b >> x;
  int v = a * a * b;
  double ans;
  if (x <= v / 2) {
    // c * b / 2 * a = x
    double c = (double)x * 2 / a / b;
    ans = M_PI / 2 - atan(c / b);
  } else {
    int y = v - x;
    // c * a / 2 * a = y
    double c = (double)y * 2 / a / a;
    ans = atan(c / a);
  }
  ans = ans * 180 / M_PI;
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    int n, k;
    cin >> n >> k;

    vector <int> dp(k + 1, 0);

    vector <int> a(n);
    for(int & x : a)
        cin >> x;

    for(int i = 1; i <= k; ++i)
    {
        for(int j = 0; j < n && a[j] <= i; ++j)
            if(!dp[i - a[j]])
            {
                dp[i] = 1;
                break;
            }
    }

    if(dp[k])
        cout << "First\n";
    else
        cout << "Second\n";

    return 0;
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

int main()
{
	int t[3];
	while (scanf("%d %d %d", t, t+1, t+2), t[0] | t[1] | t[2])
	{
		sort(t, t+3);
		double len = sqrt((double)t[0]*t[0]+t[1]*t[1]);
		int n;
		scanf("%d", &n);
		for (int i = 0; i < n; ++i)
		{
			int r;
			scanf("%d", &r);
			if (len < 2.0 * r)
				printf("OK\n");
			else
				printf("NA\n");
		}
	}

	return 0;
}

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

using namespace std;

const int M = 1e3 + 5; // number of nodes
const int N = M * M;
int vis[N] , low[N] , dfsTime[N] , comp_id[N] , Time;
vector<int> adj[N];
stack<int> st;
vector<vector<int> > comps;

int dfs(int node) { // add par if undirected
    if(vis[node])
        return vis[node] == 1 ? low[node] : 1e9;

    dfsTime[node] = low[node] = Time++;
    vis[node] = 1;
    st.push(node);

    for (int child : adj[node]) // in case of undirected continue if par
        low[node] = min(low[node] , dfs(child));

    if(low[node] == dfsTime[node]) {
        comps.push_back(vector<int>());
        do {
            vis[st.top()] = 2;
            comp_id[st.top()] = comps.size() - 1;
            comps.back().push_back(st.top());
            st.pop();
        } while(comps.back().back() != node);
    }

    return low[node];
}

bool tarjan(int n) {
    for (int i = 1 ;i <= n ;i++) // one based
        if(!vis[i])
            dfs(i);

    for (int i = 0 ;i < comps.size() ;i++)
        if (comps[i].size() > 1)
            return 0;

    return 1;
}


int id[M][M] , in[N];
int memo[N];
int solve (int node) {
    int &ret = memo[node];
    if (~ret)
        return ret;

    ret = 0;
    for (int c : adj[node])
        ret = max(ret , solve(c));

    return ret = ret + 1;
}

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

    int n;
    cin >> n;

    int nxt = 0;
    for (int i = 1 ;i <= n ;i++)
        for (int j = i + 1 ;j <= n ;j++)
            id[i][j] = nxt++;

    for (int i = 1 ;i <= n ;i++) {
        int prev = -1;
        for (int j = 0 ;j < n - 1 ;j++) {
            int a = i , b;
            cin >> b;
            if (a > b) swap(a , b);
            if (~prev) {
                adj[prev].push_back(id[a][b]);
                in[id[a][b]]++;
            }
            prev = id[a][b];
        }
    }

    if (!tarjan(n)) {
        cout << -1;
        return 0;
    }

    memset(memo , -1 , sizeof memo);
    int mx = 0;
    for (int i = 0 ;i < nxt ;i++)
        if (!in[i])
            mx = max(mx , solve(i));

    cout << mx;
}

Measured memory_bytes: 94760
n,m=map(int,input().split())

d=list()
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i)
    if i!=m//i:
      d.append(m//i)

d.sort()

c=1
for i in range(len(d)):
  if m//d[i]>=n:
    c=max(d[i],c)

print(c)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    double r;
    cin >> r;

    cout << setprecision(10) << 2.0 * r * PI << "\n";
    return 0;
}



Measured memory_bytes: 3828