akhauriyash/Code-Regression huggingface dataset:
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
#define PI 3.14159265359
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        int n, m, k;
        cin >> n >> m >> k;
        int a[n], b[m];
        loop(0, n)
        cin >> a[i];
        loop(0, m)
        cin >> b[i];
        int c = 0;
        int prea[n] = {0}, preb[m] = {0};
        prea[0] = a[0];
        preb[0] = b[0];
        for (int i = 1; i < n; i++)
            prea[i] += a[i] + prea[i - 1];
        for (int i = 1; i < m; i++)
            preb[i] += b[i] + preb[i - 1];

        for (c = 0; c < n; c++) {
            if (prea[c] > k) {
                break;
            }
        }
        //cout << "c=" << c << endl;
        int pos = c - 1;
        int i = 0;
        int sum = 0;
        if (pos >= 0)
            sum = prea[pos];
        while (sum + b[i] <= k && i < m) {
            sum += b[i];
            i++;
            c++;
        }
        int ans = c;
        //cout << sum << endl;
        while (pos >= 0 || i < m) {
            int flag = 0;
            if (pos >= 0) {
                sum -= a[pos];
                pos--;
                c--;
            }
            while (sum + b[i] <= k && i < m) {
                sum += b[i];
                i++;
                c++;
                flag = 1;
            }
            ans = max(ans, c);
            if (flag == 0 && pos < 0 )
                break;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 9852
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll multbig(ll a,ll b,ll mod){
    if(a==0 or b==0) return 0;
    if(a==1 or b==1) return (a*b)%mod;
    ll cur=multbig(a,b/2,mod);
    cur=(2*cur)%mod;
    if(b%2) cur=(cur+a)%mod;
    return cur;
}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}


#define N 	 100005
void solve(){
	ll a, b;
	char ch;
	cin>>a>>ch>>b;
	if(ch == '+') cout << a+b<<endl;
	else cout << a-b<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
typedef unsigned long long ull;
typedef pair<ll,ll> pr;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d;
    cin>>d;
    cout<<"Christmas ";
    int x=25-d;
    for(int i=0;i<x;i++){
        cout<<"Eve ";
    }
    return 0;
}


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

int main()
{
    int B_sum = 0;
    int C_sum = 0;
    int N;
    cin >> N;
    
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N-1);
    
    for (int i=0; i< N; i++){
        int a;
        cin >> a;
        A[i] = a;
    }
    for (int i=0; i< N; i++){
        int b;
        cin >> b;
        B_sum += b;
        B[i];
    }
    for (int i=0; i< N-1; i++){
        int c;
        cin >> c;
        C[i] = c;
    }
    
    for(int i=0; i<N-1; i++){
        if((A[i+1]-A[i]) == 1){
            C_sum += C[A[i]-1];
        }
    }
    
    cout << B_sum+C_sum << endl;
    
    return 0;
}


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

int main()
{
    char str1[205], str2[205];
    char *f=str1, *b=str2, *p, i;
    int m, h, len;
    while(scanf(" %s", f)) {
        if(strcmp(f, "-")==0) break;
        for(len=0; f[len]; len++);
        scanf("%d", &m);
        for(i=0; i<m; i++) {
            scanf("%d", &h);
            p=f, f=b, b=p;
            memcpy(f, b+h, len-h);
            memcpy(f+len-h, b, h);
            f[len]='\0';
        }
        puts(f);
    }
    return 0;
}

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

MOD = 10 ** 9 + 7

dp = [[[[0 for _ in range(4)] for _ in range(4)] for _ in range(4)] for _ in range(n)]

for a in range(4):
    for b in range(4):
        for c in range(4):
            dp[2][a][b][c] = 1

dp[2][0][1][2] = 0
dp[2][0][2][1] = 0
dp[2][1][0][2] = 0

for i in range(3, n):
    for a in range(4):
        for b in range(4):
            for c in range(4):
                dp[i][b][c][0] = (dp[i][b][c][0] + dp[i-1][a][b][c]) % MOD
                dp[i][b][c][3] = (dp[i][b][c][3] + dp[i-1][a][b][c]) % MOD
                if not (b == 0 and c == 2):
                    dp[i][b][c][1] = (dp[i][b][c][1] + dp[i-1][a][b][c]) % MOD
                if not ((b == 0 and c == 1) or (b == 1 and c == 0) or (a == 0 and (b == 1 or c == 1))):
                    dp[i][b][c][2] = (dp[i][b][c][2] + dp[i-1][a][b][c]) % MOD

#print(dp)

ans = 0
for a in range(4):
    for b in range(4):
        for c in range(4):
            ans = (ans + dp[n-1][a][b][c]) % MOD

print(ans)

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

pll A[105];
ll dp[105][100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, W;
    cin >> N >> W;
    REP(i, N) {
        cin >> A[i].first >> A[i].second;
    }
    fill(dp[0], dp[105], INF);
    dp[0][0] = 0;
    REP(i, N) {
        REP(j, 100001) {
            dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j]);
            if (j + A[i].second <= 100000)
                dp[i + 1][j + A[i].second] = std::min(dp[i + 1][j + A[i].second], dp[i][j] + A[i].first);
        }
    }

    ll ans = 0;
    REP(i, 100001) {
        if (dp[N][i] <= W)
            ans = i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 82304
import java.util.*;

public class Main {
	Scanner sc;
	int N;
	int[] A;
	
	int max;
	int maxIndex; // if dual max, -1
	
//=============
// constructor
//
	public Main() {
		sc = new Scanner(System.in);
	}
	
//==================
// instance methods
//
	void out(Object o) {
		System.out.println(o);
		System.out.flush();
	}
	
	int maxExcept(int index) {
		int max = -1;
		for (int i = 0; i < N; i++) {
			if (i == index) continue;
			if (max < A[i]) max = A[i];
		}
		return max;
	}
	
	public void exec() throws Exception {
		N = sc.nextInt();
		A = new int[N]; // 0, 1, ... (N-1)
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		int[] copy = Arrays.copyOf(A, N);
		Arrays.sort(copy);
		max = copy[N-1];
		
		int maxcnt = 0;
		maxIndex = -1;
		for (int i = 0; i < N; i++) {
			if (A[i] == max) {
				maxcnt++;
				maxIndex = i;
			}
		}
		if (maxcnt > 1) maxIndex = -1;
		
		for (int i = 0; i < N; i++) {
			if (i == maxIndex) out(copy[N-2]);
			else out(max);
		}
	}
	
//======
// main
//
	public static void main(String[] args) throws Exception {
		Main m = new Main();
		m.exec();
	}

}

Measured memory_bytes: 89196
import java.util.*;
import java.math.*;

public class Main {
	
	
	static BigInteger C(int n,int m)
	{
		BigInteger res = new BigInteger("1");
		for(int i=m-n+1;i<=m;i++)
			res = res.multiply(BigInteger.valueOf(i));
		for(int i=1;i<=n;i++)
			res = res.divide(BigInteger.valueOf(i));
		return res;
	}
	
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		int n,p;
		int k0=0;
		int k1=0;
		
		n = sc.nextInt();
		p = sc.nextInt();
		
		for(int i=0;i<n;i++)
		{
			int x;
			x = sc.nextInt();
			if(x%2==1)
				k1++;
			else
				k0++;
		}
		
		BigInteger ans = new BigInteger("1");
		for(int i=0;i<k0;i++)
			ans = ans.multiply(BigInteger.valueOf(2));
		if(p==0)
		{
			BigInteger add = new BigInteger("0");
			for(int i=0;i<=k1;i+=2)
				add = add.add(C(i,k1));
			
			ans = ans.multiply(add);
			
			System.out.println(ans);
		}
		else
		{
			BigInteger add = new BigInteger("0");
			for(int i=1;i<=k1;i+=2)
				add = add.add(C(i,k1));
			
			ans = ans.multiply(add);
			
			System.out.println(ans);
		}
		
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

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

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

    vector<int> c(n+1);
    c[1]=0;
    c[2]=abs(h[1]-h[2]);

    for(int i=3;i<=n;i++){
        int m;
        if(i<=k){
            m=i-1;
        }

        else{
            m=k;
        }

        int min=c[i-1]+abs(h[i]-h[i-1]);
        for(int j=2;j<=m;j++){
            if(min>(c[i-j]+abs(h[i]-h[i-j]))){
                min=c[i-j]+abs(h[i]-h[i-j]);
            }
        }

        c[i]=min;
    }

    cout<<c[n]<<"\n";
    return 0;
}


Measured memory_bytes: 3940
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<stack>
using namespace std;

long long a[100000];
vector<int> edges[100000];

int main(){
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 0; i < M; i++){
        int x, y;
        cin >> x >> y;
        edges[x].push_back(y);
        edges[y].push_back(x);
    }

    if(M == N-1){
        cout << 0 << endl;
        return 0;
    }
    if(N < 2*(N-M-1)){
        cout << "Impossible" << endl;
        return 0;
    }

    long long ans = 0;
    int conn_comp_cnt = 0;
    bool visited[100000] = {};
    for(int i = 0; i < N; i++){
        if(!visited[i]){
            int shortest_index = i;
            stack<int> st;
            st.push(i);
            while(!st.empty()){
                int now = st.top(); st.pop();
                visited[now] = true;
                if(a[shortest_index] > a[now]){
                    shortest_index = now;
                }
                for(int j = 0; j < edges[now].size(); j++){
                    if(!visited[edges[now][j]]){
                        st.push(edges[now][j]);
                    }
                }
            }
            ans += a[shortest_index];
            a[shortest_index] += 1000000000;
            conn_comp_cnt++;
        }
    }
    sort(a, a+N);
    for(int i = 0; i < 2*(N-M-1) - conn_comp_cnt; i++){
        ans += a[i];
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 6656
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
using namespace std;

int ans,sum;
void dfs(int i,int s,int n){
	if(s==sum&&n==0){
		ans++;
		return;
	}
	if(i==10||n==0)return;
	dfs(i+1,s+i,n-1);
	dfs(i+1,s,n);
}

int main(){
	int n;
	while(1){
		cin>>n>>sum;if(!n&&!sum)return 0;
		ans=0;
		dfs(0,0,n);
		cout<<ans<<endl;

	}

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }
 
int main(){
    string s;
    cin >> s;
    ll ans = 0;
    ll zero = 0, one = 0;
    for(ll i = 0; i < s.size(); i++){
        if(s[i] == '0') zero++;
        else if(s[i] == '1') one++;
    }
    cout << 2 * min(zero, one) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  string S,T;
  cin >> S >> T;
  int N = S.size();
  bool can = false;
  
  for (int i = 0; i < N; i++) {
    bool y = true;
    for (int j = 0; j < N; j++) {
      if (S[j] != T[(j+i)%N]) {
        y = false;
      }
    }
    if (y) {
      can = true;
    }
  }
  if (can) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main(){
int high[10];
int highest[3]={0,0,0};
for(int i=0;i<10;i++){
cin>>high[i];}
highest[0]=high[0];
for(int i=1;i<10;i++){
if(highest[1]>=high[i]&&high[i]>highest[2]){
highest[2]=high[i];}
if(highest[0]>=high[i]&&high[i]>highest[1]){
highest[2]=highest[1];
highest[1]=high[i];}
if(high[i]>highest[0]){
highest[2]=highest[1];
highest[1]=highest[0];
highest[0]=high[i];}
}
for(int i=0;i<3;i++){
cout<<highest[i]<<endl;}}

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

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

    int ans=n;
    for(int i=0; i<=n; i++){
        int tmp=0;
        int first=i, second=n-i;
        int j=6, k=5;

        while(j>=0){
            tmp+=first/pow(6,j);
            first%=(int)pow(6,j);
            j--;
        }
        while(k>=0){
            tmp+=second/pow(9,k);
            second%=(int)pow(9,k);
            k--;
        }

        ans=min(ans,tmp);

    }

    cout << ans << endl;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**8)
N, M = map(int, input().split())
G = dict([[i, []] for i in range(N)])
for _ in range(M):
    x, y = map(int, input().split())
    G[x-1].append(y-1)

dp = [-1] * N


def rec(v):
    if dp[v] >= 0:
        return dp[v]
    if len(G[v]) == 0:
        return 0

    ret = -1
    for nv in G[v]:
        ret = max(ret, rec(nv) + 1)

    dp[v] = ret
    return ret


print(max([rec(v) for v in range(N)]))


Measured memory_bytes: 132396
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		String[] NSplit = N.split("");
		if (NSplit[NSplit.length - 1].equals("3")) {
			System.out.println("bon");
		} else if (NSplit[NSplit.length - 1].equals("0") || NSplit[NSplit.length - 1].equals("1")
				|| NSplit[NSplit.length - 1].equals("6") || NSplit[NSplit.length - 1].equals("8")) {
			System.out.println("pon");
		} else {
			System.out.println("hon");
		}
	}
}

Measured memory_bytes: 35668
#include <stdio.h>

int main(){
    int n, i;
    int arr[100];
    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%d", &arr[i]);
    for(i=n-1; i>0; i--) printf("%d ", arr[i]);
    printf("%d\n", arr[i]);
    return 0;
}


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

main() {
    string S;
    cin >> S;
    int N = S.size();
    bool judge = false;
    if (N % 2 == 0) { 
        rep(i, N / 2) {
            string hi;
            hi += S.at(2 * i);
            hi += S.at(2 * i + 1);
            if (hi == "hi") {
                judge = false;
            }
            else if (hi != "hi") {
                judge = true;
            }
        }
    }
    else {
        judge = true;
    }
    if (judge) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
}

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

int main(void){
	int n;
	cin >> n;
	vector<int> a(n);
	int max_a = -1, max_i = -1;
 	for(int i = 0; i < n; i++){
		cin >> a[i];
		max_a = max(abs(a[i]), max_a);
		if(max_a == abs(a[i])){
			max_i = i;
		}
	}
	vector<string> ans;
	ans.resize(2*n);
	int cnt = 0;
	for(int i = 0; i < n; i++){
		if(a[i] == a[max_i]) continue;
		a[i] += a[max_i];
		ans.push_back(to_string(max_i+1) + " " + to_string(i+1) + "\n");
		cnt++;
	}
	if(a[max_i] > 0){
		for(int i = 0; i < n-1; i++){
			if(a[i] <= a[i+1]) continue;
			a[i+1] += a[i];
			ans.push_back(to_string(i+1) + " " + to_string(i+2) + "\n");
			cnt++;
		}
	}else{
		for(int i = n-2; i >= 0; i--){
			if(a[i] <= a[i+1]) continue;
			a[i] += a[i+1];
			ans.push_back(to_string(i+2) + " " + to_string(i+1) + "\n");
			cnt++;
		}
	}
	cout << cnt << endl;
	for(auto x : ans){
		cout << x;
	}
	// for(int i = 0; i < n; i++){
	// 	cout << a[i] << " ";
	// }
	// cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N=2e5+10,mod=2019;
char s[N];
ll dp[2][2020],mp2[2020];
int n;
void solve()
{
    cin>>s+1;
    n=strlen(s+1);
    ll ans=0;int cur=1;

    rep(i,1,n)
    {
        memset(dp[cur],0,sizeof(dp[cur]));
        dp[cur][s[i]-'0']++;
        for(int j=0;j<2019;++j){
            int v=(j*10+s[i]-'0')%mod;
            dp[cur][v]+=dp[1-cur][j];
        }
        ans+=dp[cur][0];
        cur=1-cur;
    }
    cout<<ans<<endl;
}
int main()
{
	//int _;cin>>_;while(_--)
	solve();
}


Measured memory_bytes: 3852
MOD = 10**9+7
facts = [1]
for i in range(1, 10**5+2):
    facts.append((i*facts[i-1])%MOD)
def nCk(n, k):
    if n < k: return 0
    return (facts[n]*pow(facts[k], MOD-2, MOD)%MOD * pow(facts[n-k], MOD-2, MOD))%MOD

n = int(input())
a = list(map(int, input().split()))

# Search doubling number and its indexes
indexes = [[] for _ in range(n+1)] # 0 to n:max(a)
for i in range(n+1):
    indexes[a[i]].append(i)
for idx in indexes:
    if len(idx) == 2: idxs = sorted(idx)

for k in range(1, n+1+1):
    p_all = nCk(n+1, k)
    p_double = nCk(n+1-(idxs[1]-idxs[0]+1), k-1)
    print((p_all-p_double)%MOD)

Measured memory_bytes: 27036
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		String[] A = new String[N];
		String[] B = new String[M];

		for(int i = 0; i < N; i++) {
			A[i] = sc.next();
		}
		for(int i = 0; i < M; i++) {
			B[i] = sc.next();
		}

		int count = 0;
		for(int i = 0; i < N-M+1; i++) {
			for(int j = 0; j < N-M+1; j++) {
				for(int k = 0; k < M; k++) {
					if(A[i+k].substring(j,j+M).equals(B[k].substring(0))) {
						count++;
					}else {
						count = 0;
						break;
					}
					if(count == M) {
						break;
					}
				}
				if(count == M) {
					break;
				}
			}
			if(count == M) {
				break;
			}
		}

		if(count == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
}


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

using namespace std;

int m[100000];
int main(){
    int n,ans=0,r;
    cin>>n;
    int m=n;
    while(n--){
        cin>>r;
        for(long long i=1;(i*i+i)*2<=r;++i){
            if((r-i)%(2*i+1)==0){
                ++ans;break;
            }
        }
    }
    cout<<m-ans<<endl;
    return 0;
}

Measured memory_bytes: 3088
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
pair<string, int>A[101];
signed main() {
  vector<int>A(5);
  vector<int>B(5);
  int count=0;
  rep(i,5){
    cin>>A[i];
    B[i]=A[i]%10;
    count+=A[i]+(B[i]==0? 0:10-B[i]);
  }
  sort(B.begin(),B.end());
  rep(i,5){
    if(B[i]!=0){
      cout<<count-(10-B[i])<<endl;
      return 0;
    }
    if(i==4){
      cout<<count<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3640
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))

p = [a[0]]
for i in range(1, n):
    p.append(gcd(p[i - 1], a[i]))

q = [a[-1]]
for i in range(n - 1):
    q.append(gcd(q[i], a[n - 2 - i]))
q = q[::-1]

res = 1
for i in range(n):
    if i - 1 < 0:
        res = max(res, q[i + 1])
    elif i + 1 >= n:
        res = max(res, p[i - 1])
    else:
        res = max(res, gcd(p[i - 1], q[i + 1]))

print(res)


Measured memory_bytes: 16136
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
    int N;
    long long int min, diff, num, max;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> num;
        diff = num -min;
        if(i == 0){
            min = num;
        }
        if(i == 1){
            max = diff;
        }
        if(min > num){
            min = num;
        }
        if(max<diff){
            max = diff;
        }
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 3116
def cost(x, y)
  sum, c = 0, 0
  while (x > 0 || y > 0)
    xi, yi = x % 10, y % 10
    sum += xi * yi + c
    c = xi + yi + c < 10 ? 0 : 1
    x /= 10
    y /= 10
  end
  sum + c
end
def calc(a, n)
  s, b = [], [], []
  a.each.with_index do |e, i|
    s[i] = Array.new(i) << e
    b[i] = Array.new(i) << 0
  end
  (1 .. n - 1).each do |i|
    (0 .. n - i - 1).each do |j|
      s[j][j + i] = s[j][j + i - 1] + a[j + i];
      min = 1 / 0.0
      (0 .. i - 1).each do |k|
        bb = b[j][j + k] + b[j + k + 1][j + i]
        next if bb >= min
        cost = bb + cost(s[j][j + k], s[j + k + 1][j + i])
        min = cost if cost < min
      end
      b[j][j + i] = min
    end
  end
  b[0][n - 1]
end
1.times do
  n = gets.to_i
  a = gets.split.map(&:to_i)
  puts calc(a, n)
end

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

const string YES = "Yes";
const string NO = "No";

vector<string> vec = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};

void solve(long long A, long long B, std::string S){
    for(int i = 0; i < A + B; ++i){
        for(int j = 0; j <= 9; ++j){
            if(i == A){
                if(S[i] != '-'){
                    cout << NO << endl;
                    return;
                }
            }else{
                if(!isdigit(S[i])){
                    cout << NO << endl;
                    return;
                }
            }
        }
    }
    cout << YES << endl;
    return;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string S;
    std::cin >> S;
    solve(A, B, S);
    return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int N, K;
    cin >> N >> K;
    ll ans = 0;
    for(ll i = K; i <= N + 1; i++){
        ll tmp = i * (N - i + 1) + 1;
        ans = (ans + tmp) % INF;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
const int maxn=1e5+10;
int a[maxn];
int vis[maxn];
int main()
{
	IO;
	for(int i=0;i<maxn;i++)vis[i]=1;
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int ta,tb;
	for(int i=0;i<m;i++){
		cin>>ta>>tb;
		if(a[ta]<a[tb]){
			vis[ta]=0;
		}else if(a[ta]>a[tb]){
			vis[tb]=0;
		}else{
			vis[ta]=0;
			vis[tb]=0;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans+=vis[i];
	}
	cout<<ans<<endl;
 	return 0;
}







Measured memory_bytes: 4436
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int solve(){
    int w,h;
    cin >>w >>h;

    vector<int> a(w), b(h);
    rep(i,w) cin >>a[i];
    rep(i,h) cin >>b[i];

    priority_queue<int> pq;
    rep(i,w){
        if(a[i]>0) pq.push(a[i]);
    }

    sort(all(b), greater<int>());
    rep(i,h){
        vector<int> x;
        rep(j,b[i]){
            if(pq.empty()) return 0;
            int v = pq.top();
            pq.pop();
            x.pb(v-1);
        }

        for(int j:x) if(j>0) pq.push(j);
    }
    return 1;
}

int main(){
    cout << solve() << endl;
    return 0;
}



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

long long mod = 1000000007;
long long fact[1 << 18];
long long inv[1 << 18];

int N, A[1 << 18], B[1 << 18];
int dp[1 << 18], par[1 << 18];
long long ans[1 << 18];
vector<int> G[1 << 18], H[1 << 18];

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 32; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long Div(long long a, long long b, long long m) {
	return (a * modpow(b, m - 2, m)) % m;
}

void init() {
	fact[0] = 1;
	for (int i = 1; i <= 250000; i++) fact[i] = (1LL * i * fact[i - 1]) % mod;
	for (int i = 0; i <= 250000; i++) inv[i] = Div(1, fact[i], mod);
}

void dfs(int pos) {
	dp[pos] = 1;
	for (int i : G[pos]) {
		if (dp[i] >= 1) continue;
		dfs(i); par[i] = pos;
		dp[pos] += dp[i];
		H[pos].push_back(i);
	}
}

void dfs2(int pos) {
	for (int i : H[pos]) {
		long long v1 = (fact[dp[i]] * fact[N - 1 - dp[i]] % mod) * inv[N - 1] % mod;
		long long v2 = (fact[N - 1] * inv[dp[i] - 1] % mod) * inv[N - dp[i]] % mod;
		ans[i] = (ans[pos] * v1 % mod) * v2 % mod;
		dfs2(i);
	}
}

int main() {
	cin >> N;
	for (int i = 1; i <= N - 1; i++) {
		cin >> A[i] >> B[i];
		G[A[i]].push_back(B[i]);
		G[B[i]].push_back(A[i]);
	}
	init();
	dfs(1);

	ans[1] = 1;
	for (int i = 1; i <= N; i++) {
		int rem = dp[i] - 1; long long rev = fact[rem];
		for (int j : G[i]) {
			if (dp[j] > dp[i]) continue;
			rem -= dp[j];
			rev *= inv[dp[j]]; rev %= mod;
		}
		rev *= inv[rem]; rev %= mod;
		ans[1] *= rev; ans[1] %= mod;
	}

	dfs2(1);

	for (int i = 1; i <= N; i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 35072
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>

// int max: 2 x 10^9, long long max: 9 x 10^18

using namespace std;

int main()
{

  int a, b;
  cin >> a >> b;

  if(a <= 5){
    cout << 0;
  }else if (5 < a && a <= 12){
    cout << b/2;
  }else{
    cout <<b;
  }

  return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x)
#define scs(x) scanf("%s", x)
#define scl(x) scanf("%lld", &x)
#define mst(a,x) memset(a, x, sizeof(a))
#define rep(i,s,e) for(int i=s; i<e; ++i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
int solve(){
    int n; sc(n); ll sum(0);
    rep(i,1,n+1) if(i%3&&i%5) sum+=i;
    return pf("%lld\n",sum);
}
int main(){
    /* int _; sc(_); while(_--) */ solve();
}

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

        int main() {    
              int H, W;
              cin>> H >> W;
              
                  vector<vector<int>> A(H, vector<int>(W)); 
                  vector<vector<int>> B(H, vector<int>(W)); 
                  for(int i=0; i<H; i++){
                     for(int j=0; j<W; j++){
                         cin >> A.at(i).at(j);  //標準入力で中身を取得
                     }
                  }
                  
                  for(int i=0; i<H; i++){
                     for(int j=0; j<W; j++){
                         B.at(i).at(j)= A.at(i).at(j);  //copy
                     }
                  }
                  
                  
                  int counter=0; 
                  
                  for(int i=0; i<H; i++){
                     for(int j=0; j<W-1; j++){
                         if((A.at(i).at(j)%2)==1){
                               A.at(i).at(j)--;
                               A.at(i).at(j+1)++;
                               counter++; 
                         }
                     }
                  }
                  
                  for(int i=0; i<H-1; i++){
                        if((A.at(i).at(W-1)%2)==1){
                              A.at(i).at(W-1)--;
                              A.at(i+1).at(W-1)++;
                              counter++; 
                        }
                  }
                  
                  cout<< counter <<endl; 
                  
                  // 繰り返し
                  
                  
                  for(int i=0; i<H; i++){
                     for(int j=0; j<W-1; j++){
                         if((B.at(i).at(j)%2)==1){
                               B.at(i).at(j)--;
                               B.at(i).at(j+1)++;
                               cout<< i+1 <<" "<<j+1<<" "<<i+1<<" "<<j+2 << endl;  
                         }
                     }
                  }
                  
                  for(int i=0; i<H-1; i++){
                        if((B.at(i).at(W-1)%2)==1){
                              B.at(i).at(W-1)--;
                              B.at(i+1).at(W-1)++;
                              cout<< i+1 <<" "<< W <<" "<<i+2 <<" "<<W << endl;  
                        }
                  }
                  
                  
                  
                  
             

             
        }

Measured memory_bytes: 4096
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
ans = 0

for ax in 0..a do
  for bx in 0..b do
    for cx in 0..c do
      if ax * 500 + bx * 100 + cx * 50 == x
        ans += 1
      end
    end
  end
end

puts ans

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();

		for (int i=0; i<s.length; i++) {
			if (i%2 == 0){
				System.out.print(s[i]);
			}
		}
		System.out.println("");
    }
}

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

def n2(n):
    counter = 0
    while n % 2 == 0:
        n = n / 2
        counter += 1
    return counter

max_resistor = 0
max_n2 = 0
for i in range(1,n+1):
    i_n2 = n2(i)
    if max_n2 <= i_n2:
        max_n2 = i_n2
        max_resistor = i
    
print(max_resistor)

Measured memory_bytes: 3060
import math

a, b, h, m = list(map(int, input().split()))  #複数数値入力
# rad_h = h / 12
# rad_m = m / 60
rad_h = h * 60 + m
rad_m = m * 12
diff_rad = abs(rad_h - rad_m)

# print(rad_h, rad_m,diff_rad*6)
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(diff_rad/720*2*math.pi))
print(c)


Measured memory_bytes: 9492
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* struct */
struct mint {
        ll x;
        mint(ll x = 0):x((x % mod + mod) % mod) {}
        mint operator-() const { return mint(-x); }
        mint& operator+=(const mint a) {
            if ((x += a.x) >= mod) x -= mod;
            return *this;
        }
        mint& operator-=(const mint a) {
            if ((x += mod - a.x) >= mod) x -= mod;
            return *this;
        }
        mint& operator*=(const mint a) {
            (x *= a.x) %= mod;
            return *this;
        }
        mint operator+(const mint a) const {
            mint res(*this);
            return res += a;
        }
        mint operator-(const mint a) const {
            mint res(*this);
            return res -= a;
        }
        mint operator*(const mint a) const {
            mint res(*this);
            return res *= a;
        }
        mint pow(ll t) const {
            if (!t) return 1;
            mint a = pow(t >> 1);
            a *= a;
            if (t & 1) a *= *this;
            return a;
        }
        // for prime mod
        mint inv() const {
            return pow(mod - 2);
        }
        mint& operator/=(const mint a) {
            return (*this) *= a.inv();
        }
        mint operator/(const mint a) const {
            mint res(*this);
            return res /= a;
        }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct combination {
        // vector size : n + 1
        vector<mint> fact, ifact;
        // precaliculation O(n)
        combination(int n):fact(n+1), ifact(n+1) {
            assert(n < mod);
            // 0! = 1;
            fact[0] = 1;
            // 1! = 0! * 1 ... n! = (n-1)! * n
            for (int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
            // 1/n! = n!^(-1)
            ifact[n] = fact[n].inv();
            // (n-1)!^(-1) = n!^(-1) * n ... 0!^(-1) = 1!^(-1) * 1
            for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
        }
        // combination O(1)
        // nCk = n! / (k! * (n-k)!)
        //     = n! * k!^(-1) * (n-k)!^(-1)
        mint operator()(int n, int k) {
            if (k < 0 || k > n) return 0;
            return fact[n] * ifact[k] * ifact[n-k];
        }
};
/* global variables */
/* function */
/* main */
int main(){
    int S;
    cin >> S;
    // a[n]: S = nの時の答え
    // a[n] = a[n-3] + a[n-4] + ... + a[0]
    // n = n-3 + 3, n-4 + 4, ...,0 + n
    // a[n-1] = a[n-4] + ... + a[0]なので
    // a[n] = a[n-3] + a[n-1]
    vector<mint> a(S+1);
    a[0] = 1;
    for (int i = 3; i <= S; i++) {
        a[i] = a[i - 1] + a[i - 3];
    }
    cout << a[S] << '\n';
}


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

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

const int N = 2e5+10 , mod = 1e9+7;

set <int> s[N];
int cur[N];
vector <int> g[N];
map <pii , int> mp;

void dfs(int v , int p){
   for(int u : g[v])
      if(u != p){
         while(s[v].find(cur[v]) != s[v].end())
            cur[v]++;
         mp[{v , u}] = mp[{u , v}] = cur[v];
         s[v].insert(cur[v]);
         s[u].insert(cur[v]);
         cur[v]++;
         dfs(u , v);
      }
}

int x[N] , y[N];

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   for(int i = 0 ; i < n - 1 ; i++){
      cin >> x[i] >> y[i];
      x[i]--;
      y[i]--;
      g[x[i]].push_back(y[i]);
      g[y[i]].push_back(x[i]);
   }
   int mx = 0;
   for(int i = 0 ; i < n ; i++){
      mx = max(mx , int(g[i].size()));
      cur[i] = 1;
   }
   cout << mx << "\n";
   dfs(0 , 0);
   for(int i = 0 ; i < n - 1 ; i++)
      cout << mp[{x[i] , y[i]}] << "\n";
   return 0;
}


Measured memory_bytes: 43920
#include <bits/stdc++.h>
using namespace std;
int main(){
	int H, W; cin >> H >> W; 
	int A[82][82] = {}; 
	int B[82][82] = {}; 
	int D[82][82] = {}; 
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> A[i][j]; 
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> B[i][j]; 
			D[i][j] = abs(A[i][j] - B[i][j]); 
		}
	}
	bool dp[82][82][13000] = {}; 
	dp[0][0][D[0][0]] = 1; 
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			for(int k = 0; k <= 80 * (i+j+1); k++){
				if(i+1 < H) dp[i+1][j][k + D[i+1][j]] |= dp[i][j][k];
				if(i+1 < H) dp[i+1][j][abs(k - D[i+1][j])] |= dp[i][j][k]; 
				if(j+1 < W) dp[i][j+1][k + D[i][j+1]] |= dp[i][j][k];
				if(j+1 < W) dp[i][j+1][abs(k - D[i][j+1])] |= dp[i][j][k]; 
			}
		}
	}
	for(int i = 0; i < 12900; i++){
		if(dp[H-1][W-1][i]){
			cout << i << endl; return 0; 
		}
	}
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

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

using ll = long long;

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

int n;
int a[200000];
ll ans;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a, a + n, greater<int>());
    ans += a[0];
    for (int i = 0; i < n - 2; ++i) {
        ans += a[1 + i / 2];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4376
W, H, N = map(int, input().split())
w, h = 0, 0

for i in range(N):
	x, y, a = map(int, input().split())

	if a == 1 and w < x:
		w = x
	elif a == 2 and W > x:
		W = x
	elif a == 3 and h < y:
		h = y
	elif a == 4 and H > y:
		H = y

if W - w <= 0 or H - h <= 0:
	print(0)
else:
	print((W - w) * (H - h))

Measured memory_bytes: 3064
# 3つの整数A,B,Cを入力
A,B,C = map(int,input().split())
# A,B,Cのうち2つは同じ整数、同じ整数でないものを出力
if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)

Measured memory_bytes: 9056
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> s(m), c(m);
	rep(i, m) cin >> s[i] >> c[i];
	vector<int> ans(n, -1);

	if (m == 0) {
		if (n != 1) {
			cout << 1;
		}
		else {
			cout << 0;
		}
		rep(i, n - 1)cout << 0;
		puts("");
		return 0;
	}
	for (int i = 0; i < m; i++)
	{
		s[i]--;
		if (ans[s[i]] == c[i])continue;
		if (ans[s[i]] == -1) {
			ans[s[i]] = c[i];
		}
		else {
			cout << -1 << endl;
			return 0;
		}
	}

	if (ans[0] == 0 && n != 1) {
		cout << -1 << endl;
		return 0;
	}
	if (ans[0] == -1 && n > 1)ans[0] = 1;
	rep(i, n) {
		if (ans[i] == -1)ans[i] = 0;

		cout << ans[i];
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
 
ll N;
int main() {
    cin >> N;
    ll a = sqrt(N);
    while (true) {
        if (N%a !=0) {
            a--;
        } else {
            break;
        }
    }

    ll b = N / a;
    cout << a-1 + b-1 << endl;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <stdlib.h>
#include <time.h>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long
#define INF 2000000000

using namespace std;

int main() {
	int n;
	cin >> n;
	printf("%d\n", (int)sqrt(n)*(int)sqrt(n));
	
	return 0;
}



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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

ll dp[100];

int main() {
    int N;
    cin >> N;
    dp[0] = 2, dp[1] = 1;
    for (int i=2; i<=N; ++i) {
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
//using ll=long long;

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    if((abs(a-c) <= d) | (abs(b-a) <= d & abs(c-b) <= d)) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#define DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
 
#define F first
#define S second 
#define pb push_back
#define endl "\n"

#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }

#ifdef DEBUG
    #define dbg(s) {s;}
#endif

#ifndef DEBUG
    #define dbg(s)
#endif

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { // from [0, x-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

#define int ll
#define i32 int32_t

#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 

#define all(v) (v).begin(),(v).end()

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

int getInt () {
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}


ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 1e6 + 7;

const ll inf = 1e9 + 7;


i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);

    IOS;

    int a,b;
    cin>>a>>b;

    a -= 2*b;
    if(a<0)
        a = 0;

    cout<<a<<endl;
    
}





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

#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<int,pi>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int I_LIMIT = 999999999;
ll L_LIMIT = 999999999999999999;
ll mod = 1e9+7;

void solve()
{
    int d,t,s;
    cin>>d>>t>>s;
    if(d>t*s)
        cout<<"No\n";
    else
        cout<<"Yes\n";
}
int main()
{
    IOS;
    solve();
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n;cin>>n;
  int a;cin>>a;
  bool ans=((n%500)<=a);
  cout << bans(ans) << endl;
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      aa: [usize; n],
      bb: [usize; n],
      cc: [usize; n-1],
    }

    let mut ans = 0;
    for i in 0..n {
        let a = aa[i];
        let b = bb[a-1];
        ans += b;
        if i > 0 {
            if aa[i] == aa[i-1] + 1 {
                ans += cc[ aa[i-1]-1 ] ;
            }
        }
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 4352