akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

void warshall_floyed(vv(ll) &C,int V) {
  rep(k,V) {
    rep(i,V) {
      rep(j,V) {
        if(C[i][j] > C[i][k] + C[k][j]) {
          C[i][j] = C[i][k] + C[k][j];
        }
      }
    }
  }
}
  
int main() {
  int H,W;
  cin >> H >> W;
  v(string) G(H);
  rep(h,H) {
    cin >> G[h];
  }
  vv(ll) C(H*W,vl(H*W,LINF));
  rep(h,H) {
    rep(w,W) {
      C[h*W+w][h*W+w] = 0;
      if(G[h][w] == '#') continue;
      if(w-1>=0&&G[h][w-1] == '.') {
        C[h*W+w][h*W+(w-1)] = 1;
      }
      if(w+1<W&&G[h][w+1] == '.') {
        C[h*W+w][h*W+(w+1)] = 1;
      }
      if(h+1<H&&G[h+1][w] == '.') {
        C[h*W+w][(h+1)*W+w] = 1;
      }
      if(h-1>=0&&G[h-1][w] == '.') {
        C[h*W+w][(h-1)*W+w] = 1;
      }
    }
  }
  warshall_floyed(C,H*W);
  ll ans = 0;
  rep(h1,H) {
    rep(h2,H) {
      rep(w1,W) {
        rep(w2,W) {
          if(G[h1][w1] == '.' && G[h2][w2] == '.' && C[h1*W+w1][h2*W+w2] != LINF) {
            ans = max(ans,C[h1*W+w1][h2*W+w2]);
          }
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(long long i=m;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()
using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b+c==17&&(a==5||a==7)&&(b==5||b==7)&&(c==5||c==7)){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-04-30(Thu)
   note   
**********************************************************************/

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

int main() {
  int n; 
  cin >> n;
  vector<int64_t> lucas_number(n+1);
  lucas_number.at(0) = 2LL;
  lucas_number.at(1) = 1LL;

  for (int i = 2; i <= n; i++ ) {
    lucas_number.at(i) = lucas_number.at(i-1) + lucas_number.at(i-2);
  }

  cout << lucas_number.at(n) << endl;
}

Measured memory_bytes: 256
import java.net.StandardSocketOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;

import org.omg.Messaging.SyncScopeHelper;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_200().doIt();
	}
	class Test_200{
		void doIt() {
			int N = sc.nextInt();
			int M = sc.nextInt();
			int C = sc.nextInt();
			int B[] = new int[M];
			int A[][] = new int[N][M];
			int cnt = 0;
			
			for(int i = 0;i < M;i++)B[i] = sc.nextInt();
			for(int i = 0;i < N;i++) {
				for(int j = 0;j < M;j++) {
					A[i][j] = sc.nextInt();
				}
			}
			
			for(int i = 0;i < N;i++) {
				int Cost = C;
				for(int j = 0;j < M;j++) {
					Cost = Cost + A[i][j]*B[j];
				}
				if(Cost > 0)cnt++;
			}
			
			System.out.println(cnt);
		}
	}
}


Measured memory_bytes: 23892
results = []
while True:
    m, f, r = [int(i) for i in input().split()]
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        results.append('F')
    elif m + f >= 80:
        results.append('A')
    elif m + f >= 65:
        results.append('B')
    elif m + f >= 50:
        results.append('C')
    elif m + f >= 30:
        if r >= 50:
            results.append('C')
        else:
            results.append('D')
    else:
        results.append('F')

for result in results:
    print(result)



Measured memory_bytes: 5600
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	long long int w, a, b;
	cin >> w >> a >> b;
	if (a + w < b) {
		cout << b - a - w;
	}
	else if (b + w < a) {
		cout << a - b - w;
	}
	else {
		cout << 0;
	}
}

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

int main()
{
    string s;
    cin >> s;
    int count = 0;
    //最初を0でやって行く
    rep(i, s.size())
    {
        if (i % 2 == 0)
        {
            if (s[i] != '0')
            {
                count += 1;
            }
        }
        if (i % 2 == 1)
        {
            if (s[i] == '0')
            {
                count += 1;
            }
        }
    }
   // cout<<min(count ,s.size()-count);
  if (count>(s.size()-count)){
  cout <<s.size()-count;
    
  }
  else{
  cout <<count;
    
  }
}

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

struct ans {
	int p, s, deg, dep;
};
ans a[30];
int id, r[30], l[30];
int h[30];


void sedep(int i,int depth) {
	a[i].dep = depth;
	depth++;
	if (r[i] != -1) {
		sedep(r[i], depth);
	}
	if (l[i] != -1) {
		sedep(l[i], depth);
	}
}

void sehi(int i, int hight) {
	h[i] = max(h[i], hight);
	hight++;
	if (a[i].p != -1) sehi(a[i].p, hight);
}

void print(int i) {
	cout << "node " << i << ": parent = " << a[i].p << ", sibling = " << a[i].s << ", degree = ";
	cout << a[i].deg << ", depth = " << a[i].dep << ", height = " << h[i] << ", ";
	if (a[i].p == -1)cout << "root";
	else if (h[i] != 0)cout << "internal node";
	else cout << "leaf";
	cout << endl;
}

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

	bool z[30];
	fill(z, z + N, false);
	fill(h, h + N, 0);
	
	
	for (int i = 0; i < N; i++) {
		cin >> id;
		cin >> l[id] >> r[id];
		int c = 0;
		a[l[id]].s = r[id];
		a[r[id]].s = l[id];
		if (l[id] != -1) {
			a[l[id]].p = id;
			c++;
			z[l[id]] = true;
		}
		if (r[id] != -1) {
			a[r[id]].p = id;
			c++;
			z[r[id]] = true;
		}
		a[id].deg = c;
	}
	
	int ro;
	for (int i = 0; i < N; i++) {
		if (z[i] == false) {
			a[i].p = -1;
			a[i].s = -1;
			ro = i;
			break;
		}
	}
	sedep(ro, 0);

	for (int i = 0; i < N; i++) {
		if (a[i].deg == 0) {
			sehi(i, 0);
		}
	}

	for (int i = 0; i < N; i++) {
		print(i);
	}
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0;i<N;i++) {
        cin >> A.at(i);
    }
    int dif = 0;
    for (int i=0;i<N-1;i++) {
        for (int j=i+1;j<N;j++) {
            dif = max(dif,abs(A.at(i)-A.at(j)));
        }
    }
    cout << dif << endl;
}


Measured memory_bytes: 3596
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if((a+b)%2 != 0){
			System.out.println("IMPOSSIBLE");
		}
		else{
			System.out.println((a+b)/2);
		}

	}

}


Measured memory_bytes: 20692
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    if(n==1){
        cout << "Yes" << endl;
        return 0;
    }
    char r1[200005];
    char r2[200005];
    rep(i,n){
        r1[s[i]]='1';
        r2[t[i]]='1';
    }
    bool ok = 1;
    rep(i,n){
        if(r1[s[i]]=='1') r1[s[i]]=t[i];
        if(r2[t[i]]=='1') r2[t[i]]=s[i];
        if(r1[s[i]] != '1' && r1[s[i]] != t[i]) ok = 0;
        if(r2[t[i]] != '1' && r2[t[i]] != s[i]) ok = 0;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

int main(){
  int n;
  std::cin >> n;
  std::vector<int> c(n);
  std::vector<std::pair<int, int>> a(n - 1);
  for(int i = 0; i < n - 1; i++){
    std::cin >> a[i].first;
    std::cin >> a[i].second;
  }
  for(int i = 0; i < n; i++){
    std::cin >> c[i];
  }

  std::sort(c.begin(), c.end(), std::greater<int>());
  int sum = 0;
  for(int i = 1; i < n; i++){
    sum += c[i];
  }

  int now;
  std::vector<int> stac, ans(n);
  stac.push_back(1);
  while(!stac.empty()){
    now = stac[0];
    for(int i = 0; i < n - 1; i++){
      if(a[i].first == now || a[i].second == now){
        stac.push_back(a[i].first + a[i].second - now);
        a[i].first = -1;
        a[i].second = -1;
      }
    }
    ans[now - 1] = c[0];
    c.erase(c.begin());
    stac.erase(stac.begin());
  }

  std::cout << sum << std::endl;
  for(int i = 0; i < n; i++){
    std::cout << ans[i] << " ";
  }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double deg = abs(2 * M_PI / 12 * h + 2 * M_PI / 12 * m / 60 - 2 * M_PI / 60 * m);
    double c2 = a * a + b * b - 2 * a * b * cos(deg);
    cout << fixed << setprecision(20);
    cout << sqrt(c2) << endl;
}


Measured memory_bytes: 4288
#include<stdio.h>
#include<string.h>
#define N 1000

int lcs(char *, char *);
int isHigher(int, int);

int main()
{
  int q,i,ret;
  char X[N+1],Y[N+1];

  scanf("%d",&q);

  for(i = 0; i < q; i++){
    scanf("%s %s",&X[1],&Y[1]);
    X[0] = Y[0] = ' ';
    ret = lcs(X,Y);
    printf("%d\n",ret);
  }
  
  return 0;
}

int lcs(char X[], char Y[])
{
  int c[N+1][N+1];
  int m,n,maxl = 0,i,j;

  m = strlen(X)-1;
  n = strlen(Y)-1;

  X[0] = ' ';
  Y[0] = ' ';

  for(i = 0; i <= m; i++)c[i][0] = 0;
  for(j = 1; j <= n; j++)c[0][j] = 0;

  for(i = 1; i <= m; i++){
    for(j = 1; j <= n; j++){
      if(X[i] == Y[j]){
	c[i][j] = c[i-1][j-1] + 1;
      }else c[i][j] = isHigher(c[i][j-1],c[i-1][j]);
      maxl = isHigher(maxl,c[i][j]);
    }
  }

    return maxl;
}

int isHigher(int x, int y)
{
  if(x >= y)return x;
  else return y;
}



Measured memory_bytes: 5652
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BPowerSocket {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int A, B;
        cin >> A >> B;
        if (B == 1) {
            cout << 0 << endl;
            return;
        }
        int res = 1;
        int cur = A;
        while (cur < B) {
            cur += A - 1;
            res++;
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BPowerSocket solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<stdlib.h>
#include<iostream>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
const int N = 2e5+10;
int a[N];
int n;
int solve(int i , int m)
{
	if(m == 0)
	  return 1;
	if(i >= n)
	  return 0;
	int res = solve(i+1,m)||solve(i+1,m-a[i]);
	return res;
}
int main()
{
	int q , M;
	cin >> n;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> a[i];
	}
	cin >> q;
	for(int i = 0 ; i < q ; i++)
	{
		cin >> M;
		if(solve(0,M))
		  printf("yes\n");
		else
		  cout << "no" << endl;
	}
	return 0;
}


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

int main() {
    while (true) {
        int l;
        cin >> l;
        if (l == 0) break;

        bool ok = true;
        rep(i, 12) {
            int m, n;
            cin >> m >> n;
            if (m-n >= l) {
                if (ok) cout << i+1 << endl;
                ok = false;
            } else l -= m-n;
        }
        if (ok) cout << "NA" << endl;
    }

    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

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

using namespace std;

int main(){
    int N, T;
    ll ans = 0;
    cin >> N >> T;
    int prev = -T;
    int t = 0;
    rep(i, N){
        cin >> t;
        ans += min(t - prev, T);
        prev = t;
    }
    cout << ans << endl;
    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)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

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

    vector<ll> g[10];
    rep(i,n)
    {
        int genre;
        ll c;
        cin >>c >>genre;
        g[genre-1].pb(c);
    }
    rep(i,10) sort(all(g[i]),greater<int>());

    ll dp[11][2001]={0};
    rep(i,10)
    {
        //?????¬????£???£?????°
        rep(j,k+1)
        {
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);

            ll add=0;
            //?????£??????i?????¬????£??????°
            rep(x,g[i].size())
            {
                int nx=j+x+1;
                if(nx>k) break;

                add+=g[i][x];
                dp[i+1][nx]=max(dp[i+1][nx],dp[i][j]+add+x*(x+1));
            }
        }
    }

    cout << dp[10][k] << endl;
    return 0;
}

Measured memory_bytes: 3352
//IOI 2021

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

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 100 * 1000 + 17;

int n;
pii a[MAXN];
ll t1, t2;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i].ff >> a[i].ss;
	sort(a + 1, a + n + 1, [](pii i, pii j) { return i.ff + i.ss > j.ff + j.ss; });
	for (int i = 1; i <= n; i++)
		if (i % 2)
			t1 += a[i].ff;
		else
			t2 += a[i].ss;
	cout << t1 - t2 << endl;
	return 0;
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n,a,b;cin>>n>>a>>b;
  cout<<min(n*a, b)<<endl;

  return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#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 Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
#define oset tree<pi, null_type,greater<pi>, rb_tree_tag,tree_order_statistics_node_update>

#define N 20003
vector<int> adj[N];
int n;

vector<int> bfs(int st)
{
    vector<int> d(n+5, -1);
    queue<int> qu;
    qu.push(st);
    d[st] = 0;
    while(!qu.empty()){
        int u = qu.front();
        qu.pop();
        for(auto v: adj[u]){
            if(d[v] == -1){
                qu.push(v);
                d[v] = d[u]+1;
            }
        }
    }
    return d;
}

int main()
{
    int x, y;
    cin >> n >> x >> y;
    n++;
    for(int i=1; i<n-1; i++){
        adj[i].push_back(i+1);
        adj[i+1].push_back(i);
    }
    adj[x].push_back(y);
    adj[y].push_back(x);

    int cnt[n+5] = {0};
    for(int i=1; i<n; i++){
        vector<int> dis = bfs(i);
        for(int j=i; j<=n; j++){
            cnt[dis[j]]++;
        }
    }
    for(int i=1; i<n-1; i++){
        cout << cnt[i] << "\n";
    }

    return 0;
}


Measured memory_bytes: 4136
#include <bits/stdc++.h> 
using namespace std;
const double EPS = 1e-6;

double a, b;

double c(double a){
    if(a < EPS) return a + 360;
    if((a - 360) > EPS) return a - 360;
    return a;
}

double calc(double t){
     if(abs(c(a + t) - c(b - t)) < 1e-6) return c(a + t);
    if(abs(c(a - t) - c(b + t)) < 1e-6) return c(a - t);
     return -1.0;
}

int main(){
    cin >> a >> b;
    double MIN = -1.0, ans;
    if(a >b) swap(a, b);
    for(double t = 0.0; t <= 360.0; t += 0.00001){
        double tmp = calc(t);
        if(abs(tmp - (-1.0)) < EPS) continue;
        else{
            ans = tmp;
            break;
        }
       
    }
    // ans = a + MIN;
    printf("%.10f\n", ans); 
}

Measured memory_bytes: 3228
while True:
    n,x=map(int,input().split())
    
    if n==0 and x==0:
        break
    
    L=list(range(1,n+1))
  
    
    a=0
    for i in range(n-2):
        b=L[i]
        for j in range(1,n-1):
            c=L[j]
            for k in range(2,n):
                d=L[k]
                
                if b+c+d==x:
                    
                    if b>=c or c>=d :
                        pass
                    else:
                        a+=1
                    
    
    print(a)


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

using namespace std;

int main() {
  int N,K,result=1;
  cin >> N >> K;

  for(int i=0; i< N;i++){
    if(result*2 - result < K){
      result *= 2;
    }else{
      result += K;
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, M = map(int, input().split())
e = dd(list)

for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
mxd = 0
res = [[-1] * 11 for _ in range(N + 1)]
Q = int(input())
qd = [0] * Q
qc = [0] * Q
for i in range(Q):
  v, d, c = map(int, input().split())
  qd[i] = d
  qc[i] = c
  res[v][d] = i
  mxd = max(mxd, d)
#print(qc)

#print(mxd)
for t in range(mxd):
  tres = [x[: ] for x in res]
  for x in range(1, N + 1):
    for y in e[x]:
      for i in range(t + 1, 11):
        res[y][i] = max(res[y][i], tres[x][i])

#print(res)
for r in res[1: ]:
  x = -1
  for i in range(11):
    if r[i] != -1: x = max(x, r[i])
  if x == -1: print(0)
  else: print(qc[x])

Measured memory_bytes: 177792
#include <stdio.h>
 
int main(){
    int N, M, L;
    int a[100][100], b[100][100];
    long c[100][100]={0};
 
    scanf(" %d %d %d", &N, &M, &L);
    for(int i=0; i<N; ++i){
        for(int j=0; j<M; ++j){
            scanf(" %d", &a[i][j]);
        }
    }
     
    for(int i=0; i<M; ++i){
        for(int j=0; j<L; ++j){
            scanf(" %d", &b[i][j]);
        }
    }
 
    for(int i=0; i<N; ++i){
        for(int j=0; j<L; ++j){
            for(int k=0; k<M; ++k){
                c[i][j] += a[i][k]*b[k][j];
            }
        }
    }
     
    for(int i=0; i<N; ++i){
        for(int j=0; j<L; ++j){
            printf("%ld", c[i][j]);
            if(j!=L-1) printf(" ");
        }
        printf("\n");
    }
 
    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define int long long
#define R(i,a,n) for(int i=a;i<n;i++)
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int h,w;

int s1(){
	if(h%3==0)return 0;
	return w;
}

int s2(){
	if(w%3==0)return 0;
	return h;
}

int s3(){
	int ans=1e9;
	R(i,1,h){
		int H=(h-i);
		if(w%2)ans=min(ans,max(w*i,(w/2+1)*H)-min(w*i,(w/2)*H));
		else ans=min(ans,max(w*i,(w/2)*H)-min(w*i,(w/2)*H));
	}
	return ans;
}

int s4(){
	int ans=1e9;
	R(i,1,w){
		int W=(w-i);
		if(h%2)ans=min(ans,max(h*i,(h/2+1)*W)-min(h*i,(h/2)*W));
		else ans=min(ans,max(h*i,(h/2)*W)-min(h*i,(h/2)*W));
	}
	return ans;
}


main(){
	cin>>h>>w;
	cout<<min({s1(),s2(),s3(),s4()})<<endl;
}

Measured memory_bytes: 256
n = gets.chomp!.to_i
min = 10**9
a = gets.chomp!.split(" ").map{|i|
    i = i.to_i
}
a.each do|i|
    if (min > i) then
        min = i
    end
end
min2 = min
while(1) do
    flag = 0
    (a.length).times do |i|
        m =a[i] % min2
        if ( (m!=0) && (m<min2) )then
            min2 = m
            flag = 1
            break
        end
    end
    if flag == 0 then break 
    end
end
puts min2


Measured memory_bytes: 8452
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, XY):
    rc = [False] * (N + 1)
    bn = [1] * (N + 1)

    rc[1] = True
    for x, y in XY:
        bn[x] -= 1
        bn[y] += 1
        if rc[x]:
            rc[y] = True
        if bn[x] == 0 and rc[x]:
            rc[x] = False

    return rc.count(True)


def main():
    N, M = read_int_n()
    XY = [read_int_n() for _ in range(M)]
    print(slv(N, M, XY))


if __name__ == '__main__':
    main()


Measured memory_bytes: 31260
#include<iostream>
using namespace std;
int main(){
	int n,ans=0,i,j,p[20];
	cin>>n;
	for(i=0;i<n;i++)cin>>p[i];
	for(i=2;i<n;i++){
		if(p[i]<p[i-1]&&p[i-1]<p[i-2])ans++; 
		if(p[i]>p[i-1]&&p[i-1]>p[i-2])ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int
#define pb push_back
#define mk make_pair
#define flp(i, k, n) for(int i=k; i<n; i++)
#define rev(i, k) for(int i=k; i>=0; i--)
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};

int32_t main(void)
{
    int r;
    cin>>r;
    r*=2;
    cout<<(double)(r)*(double)(3.14)<<"\n";
    return 0;
}

Measured memory_bytes: 3784
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n>>a;
    int arr[n +1];
    int pref[n + 1] = {};
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        pref[i] = pref[i - 1] + arr[i];
    }

    for(int i=a + 1; i<=n; i++) {

        int val1 = pref[i] - pref[i - a];
        int val2 = pref[i - 1] - pref[i - a - 1];

        if(val1 > val2){
            cout<<"Yes\n";
        }
        else
            cout<<"No\n";
    }  
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


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

void fnInput(vector<int> &a_rvoTarget, vector<int> &a_rvoSearch)
{
  int iTargetCnt;
  cin >> iTargetCnt;

  a_rvoTarget.resize(iTargetCnt + 1);
  for (int i = 0; i < iTargetCnt; i++)
    cin >> a_rvoTarget[i];

  int iSearchCnt;
  cin >> iSearchCnt;

  a_rvoSearch.resize(iSearchCnt);
  for (int i = 0; i < iSearchCnt; i++)
    cin >> a_rvoSearch[i];
}

void fnLinearSearch(vector<int> &a_rvoTarget, const vector<int> &a_cnrvoSearch, int &a_riFound)
{
  int iMaxSize = a_rvoTarget.size() - 1;
  for (auto itvoSearch = begin(a_cnrvoSearch); itvoSearch != end(a_cnrvoSearch); itvoSearch++)
  {
    a_rvoTarget[iMaxSize] = *itvoSearch;
    auto itvoTarget = begin(a_rvoTarget);
    while (*itvoSearch != *itvoTarget)
      itvoTarget++;
    if (distance(begin(a_rvoTarget), itvoTarget) != iMaxSize)
      a_riFound++;
  }
}

void fnResultOut(int a_iFound)
{
  cout << a_iFound << endl;
}

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

  vector<int> voTarget, voSearch;
  int iFound = 0;

  fnInput(voTarget, voSearch);
  fnLinearSearch(voTarget, voSearch, iFound);
  fnResultOut(iFound);

  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200, MAXINT=2147483647;
ll b[N], t, n, mi=MAXINT;
vector<string> m, a, r, c, h;
ll M, A, R, C, H;
string s;
int main() {
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> s;
        switch (s[0]) {
            case 'M': m.push_back(s); break;
            case 'A': a.push_back(s); break;
            case 'R': r.push_back(s); break;
            case 'C': c.push_back(s); break;
            case 'H': h.push_back(s); break;
            default: continue;
        }
    }
    M=m.size(); A=a.size(); R=r.size(); C=c.size(); H=h.size();
    cout << M*A*R+M*A*C+M*A*H+M*R*C+M*R*H+M*C*H+A*R*C+A*R*H+A*C*H+R*C*H;
}

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

int main(){
  
  ll n,W;
  cin >> n >> W;
  
  ll*w = new ll[n];
  ll*v = new ll[n];
  
  for( ll i=0 ; i<n ; i++ ){
  	cin >> w[i] >> v[i];
  }
  
  ll** dp = new ll*[n+1];
  
  for( ll i=0; i<n+1 ; i++ ){
  	dp[i] = new ll[W+1];
  	for(ll j=0 ; j<W+1 ; j++)
  		dp[i][j] = 0;
  }
  
  for(ll i=0 ; i<=n ; i++){
  	for(ll j=0 ; j<=W ; j++){
  		if (i == 0 || j == 0) 
                dp[i][j] = 0; 
  		else if(w[i-1] <= j){
  			dp[i][j] = max( dp[i-1][j], dp[i-1][j-w[i-1]] + v[i-1] );
  		}else{
  			dp[i][j] = dp[i-1][j];
  		}
  	}
  }
  
  cout << dp[n][W] << endl;
  return 0;
}

Measured memory_bytes: 82684
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#define mt(a) memset(a,0,sizeof(a))
#define ll long long
const ll INF = 0x3f3f3f3f;
using namespace std;
int main (void)
{
	int n;
	ll a[100050];
	ll p[100050];
	mt(a);
	mt(p);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i],p[i] = a[i];
	sort(a+1,a+1+n);
	sort(p+1,p+1+n);
	ll x = 0;
	for(int i=1;i<=n-1;i++)
	{
		p[i]+=x;
		x = p[i];
	}
	int l = 0;
	int r = n;
	int cnt = INF;
	while(l<=r)
	{
		int mid = (l+r)/2;
		if(2*p[mid]>=a[n])
		{
			cnt = min(mid,cnt);
			r = mid-1;
		}
		else
		{
			for(int j=mid+1;j<=n-1;j++)
			{
				if(2*p[mid]>=a[j])
				{
					p[mid]+=a[j];
					if(2*p[mid]>=a[n])
						break;
				}
				else
					break;
			}
			if(2*p[mid]>=a[n])
			{
				cnt = min(mid,cnt);
				r = mid-1;
			}
			else
				l = mid+1;
		}
	}
	cout<<n-cnt+1<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1<<30;

int main(){
  string s="    ";
  cin>>s[0]>>s[1]>>s[2]>>s[3];
  sort(s.begin(), s.end());
  cout<<(s=="1479"?"YES":"NO")<<endl;
  
}

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

int main() {
    string s;
    bool ok = true, num = false, up = false, low = false;
    cin >> s;
    ok &= s.size() >= 6;
    for(auto c : s){
        num |= c >= '0' && c <= '9';
        low |= c >= 'a' && c <= 'z';
        up |= c >= 'A' && c <= 'Z';
    }
    ok &= num;
    ok &= low;
    ok &= up;
    cout << (ok?"VALID":"INVALID") << endl;
    return 0;
}


Measured memory_bytes: 3236
n=int(input())
a= [int(x) for x in input().split()]
ans=0
ng=0
while ng==0:
	for i in range(len(a)):
		if a[i]%2!=0:
			ng=1
			break
	if ng==0:
		for i in range(len(a)):
			a[i]/=2
		ans+=1

print(ans)


Measured memory_bytes: 3316
#include <stdio.h>
 
int main() {
  
  int s, m, h;
  scanf("%d", &s);
 
  h = s / (60 * 60);
  s = s % (60 * 60); 
 
  m = s / 60;
  s = s % 60;
 
  printf("%d:%d:%d\n", h, m, s);

  return 0;
}
 

Measured memory_bytes: 1792
import sys

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

if N==0:
  print(X)
  sys.exit()

p=list(map(int,input().split()))

if not(X in p):
  print(X)
  sys.exit()

big=X+1
sma=X-1
for i in range(N):
  if big in p and sma in p:
    big+=1
    sma-=1
    continue
  elif big in p and not(sma in p):
    print(sma)
    break
  elif not(big in p) and sma in p:
    print(big)
    break
  else:
    print(sma)
    break

Measured memory_bytes: 9216
#include <stdio.h>

main()
{
 
int a,b;

scanf("%d %d",&a,&b);

int x,y,z;

x=a+b;y=a-b;z=a*b;

if (x>=y && x>=z) printf("%d",x);
else if(y>=x && y>=z) printf("%d",y);
else if(z>=x && z>=y) printf("%d",z);

return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include<string>
using namespace std;
int main(){
    int n,l,a[200],b[200],A=0,B=100000,C;
    cin>>n>>l;
    for(int i=0;i<n;i++){
        a[i]=(l+i);
        b[i]=a[i];
        A=(A+a[i]);
        if(a[i]<0)b[i]=(a[i]-(a[i]*2));
        if(B>(b[i]-0)){
            B=(b[i]-0);
            C=a[i];
        }
    }cout<<(A-C)<<endl;
}

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

using namespace std;

typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

int main()
{
    int N, M;
    cin >> N >> M;

    for(int i = (M / N); i >= 1;i--)
    {
        if(M % i == 0)
        {
            int y = M / i;
            if(y >= N)
            {
                cout << i << endl;
                return 0;
            }
        }
    }

    cout << 1 << endl;

    return 0;
}



Measured memory_bytes: 256
S=input()
T=input()

def func():
    z=0
    for i in range(0,len(S)-len(T)+1):
        p=0
        for j in range(0,len(T)):
            if T[j]==S[i+j]:
                p+=1
        if z<p:
            z=p
    return(len(T)-z)

print(func())

Measured memory_bytes: 67540
#include <stdio.h>
int F[50];
int fib(int n) {
	if (n == 0 || n == 1) {
		return F[n]=1;
	}
	if (F[n] != -1) return F[n];
	return F[n]=fib(n - 1) + fib(n - 2);
}
int main(void) {
	int n,i=50;
	while (i--) F[i]=-1;
	scanf("%d", &n);
	printf("%d\n",fib(n));
	return 0;
}


Measured memory_bytes: 2764
#include <stdio.h>
main(){
  int i,j,key,n,k;
  int A[100];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
      printf("%d",A[i]);
      if(i<n-1) printf(" ");
    }
  printf("\n");
  for(i=1;i<=n-1;i++)
    {
      key=A[i];
      j=i-1;
      while(j>=0&&A[j]>key)
	{
	  A[j+1]=A[j];
	  j--;
	}
      A[j+1]=key;
      for(k=0;k<n;k++)
	{
	  printf("%d",A[k]);
	  if(k<n-1) printf(" ");
	}
      printf("\n");
    }
  return 0;
}

Measured memory_bytes: 604
#include<stdio.h>
#include<stdlib.h>

typedef long long int int64;

#define MIN(a,b) ((a)<(b)?(a):(b))

typedef struct point{
  int x,y;
} point;

int cmpPoint(const void *a,const void *b){
  point *p=(point *)a;
  point *q=(point *)b;
  if(p->x!=q->x) return p->x-q->x;
  return p->y-q->y;
}

int cmp(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  point *p=(point *)calloc(n,sizeof(point));
  int i;
  for(i=0;i<n;i++){
    int x,y;
    scanf("%d%d",&x,&y);
    p[i]=(point){x,y};
  }
  qsort(p,n,sizeof(point),cmpPoint);
  int64 min=4000000000000000000LL;
  for(i=0;i<n;i++){
    for(int j=i+k-1;j<n;j++){
      int dx=p[j].x-p[i].x;
      int y[50];
      int l;
      for(l=0;l<=j-i;l++){
	y[l]=p[i+l].y;
      }
      qsort(y,j-i+1,sizeof(int),cmp);
      int dy=y[k-1]-y[0];
      for(l=1;l+k-1<=j-i;l++) dy=MIN(dy,y[l+k-1]-y[l]);
      min=MIN(min,(int64)dx*dy);
    }
  }
  printf("%lld\n",min);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define IOS ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"

int main()
{
	string ch,bh,gh;
	int a,b;
	
	cin>>ch >> bh;
	cin >> a >> b;
    cin>>gh;
   map<string,int>mp;
   mp.insert({ch,a});
   mp.insert({bh,b});
   mp[gh] -= 1;
   cout << mp[ch] << " " << mp[bh] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    int s = 0, maxi = 0;
    for (int i = 0; i < n; ++i)
    {
        int c;
        cin >> c;
        s += c;
        maxi = max(maxi, c);
    }
    cout << maxi / 2 + (s - maxi);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <string.h>
using namespace std;

int main(){
    int n,d,ans=0;
    cin >>n>>d;

    if(n%(d*2+1)>0)
      ans = n / (d * 2 + 1) + 1;
    else
      ans = n / (d * 2 + 1);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vi vector<int>
#define sl set<ll>
#define sc set<char>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mpi map<ll,ll>
#define mpc map<char,ll>
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inf        1000000000000

int main()
{
	string s,t;
	cin>>s>>t;
	ll n=s.length(),m=t.length();
	ll dp[n+1][m+1];
	forn(i,n+1)
	{
		forn(j,m+1)
		{
			if(i==0 || j==0)
			{
			    dp[i][j]=0;
			}
			else if(s[i-1]==t[j-1])
			{
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	    ll ans=dp[n][m];
	    char arr[ans+1];
	    arr[ans]='\0';
	    ll i=n,j=m;
	    while(i>0 && j>0)
	    {
	        if(s[i-1]==t[j-1])
	        {
	            arr[ans-1]=s[i-1];
	            i--;j--;ans--;
	        }
	        else
	        {
	            if(dp[i-1][j]>dp[i][j-1])
	            i--;
	            else
	            j--;
	        }
	    }
    cout<<arr;
}

Measured memory_bytes: 70656
#include <iostream>
#include <queue>
#include <map>
using namespace std;

#define ISLOOP 999999999

int sugoroku[100001];
int edges[100001];
bool visited[100001];

int next_position(int curr) {
    if (sugoroku[curr] == 0) return curr;
    if (edges[curr] != -1)   return edges[curr];
    if (visited[curr])       return ISLOOP;

    visited[curr] = true;
    return edges[curr] = next_position(curr + sugoroku[curr]);
}

int main() {
    int n; cin >> n;
    for (int i=0; i<n; i++) cin >> sugoroku[i];

    // init
    for (int i=0; i<n; i++) edges[i] = -1;

    // ??????????¨????
    for (int i=0; i<n; i++) {
        // visited???????????????
        // cout << "i = " << i << endl;
        edges[i] = next_position(i);
    }

    for (int i=0; i<n; i++) visited[i] = false;
    visited[0] = true;
    queue<pair<int, int> > q;
    q.push( make_pair(0,0) );

    int ans = 0;
    while( !q.empty() ){
        pair<int,int> p = q.front(); q.pop();
        int curr = p.first;
        int step = p.second;
        //cout << "curr = " << curr << " , step = " << step << endl;
        for (int i=1; i<=6; i++) {
            if (curr + i >= n - 1) {
                ans = step + 1;
                break;
            }
            int next = edges[curr + i];
            if (next == ISLOOP || visited[next]) continue;
            if (next == n - 1) {
                ans = step + 1;
                break;
            }
            visited[next] = true;
            q.push( make_pair(next, step + 1) );
        }
        if (ans > 0) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5276
require 'prime'
N = gets.to_i
MOD = 10 ** 9 + 7
division = (2..N).reduce({}) do |acc, n|
  n.prime_division.to_h.merge(acc) do |k, o, n|
    o + n
  end
end
ans = division.reduce(1) do |acc, (_, c)|
  acc * (c + 1) % MOD
end
puts ans


Measured memory_bytes: 5500
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    vector<int> A(N + 1);
    for (int i = 1; i <= N; ++i) {
        cin >> A[i];
    }
    vector<int> ans;
    for (int i = N; i > 0; --i) {
        int total = 0;
        for (int j = 2; i * j <= N; ++j) {
            total += A[i * j];
        }
        if (A[i] != total % 2) {
            A[i] = 1;
            ans.push_back(i);
        } else {
            A[i] = 0;
        }
    }
    cout << ans.size() << endl;
    copy(ans.crbegin(), ans.crend(), ostream_iterator<int>(cout, " "));
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 2424
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,x,y,s=0;
    cin>>a>>b>>c>>x>>y;
    c*=2;
    if(a+b>c)
    {
        if(x>y)
        {
            s+=c*y;
            x=x-y;
            y=0;
            if(a>c)
                s+=c*x;
            else
                s+=a*x;
        }
        else
        {
            s+=c*x;
            y=y-x;
            x=0;
            if(b>c)
                s+=c*y;
            else
                s+=b*y;
        }
    }
    else
        s=x*a+y*b;
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
cnt2=0
while sum(h)>0:
  cnt=0
  if 0 in h:
    for i in range(1,n):
      if h[i]==0 and h[i-1]>0 and sum(h[i:])!=0:
        cnt+=1
  for i in range(n):
    if h[i]>0:
      h[i]-=1
  cnt2=cnt2+cnt+1

print(cnt2)

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

int main() {
  int N,K;
  cin >> N >> K;
  int a = 1;
  
  for(int i = 0; i < N; i++){
    if(a * 2 < a + K){
      a *= 2;
    }else{
      a += K;
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=(ll)(1e9+7);

int main(){
    string n;
    cin>>n;
    int ans=0;
    for(char ch:n){
        if(ch=='2')
            ans++;
    }
    cout<<ans;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
    string w;
    int c = 0;
    
    cin >> w;
    
    while (true) {
        string t;
        cin >> t;
        if (t == "END_OF_TEXT") break;
        
        if (t.size() != w.size()) continue;
        bool found = 1;
        for (int i = 0; i < w.size(); i++) {
            if (toupper(w[i]) != toupper(t[i])) {
                found = 0;
                break;
            }
        }
        if (found) c++;
    }
    
    cout << c << endl;
    
    return 0;
}


Measured memory_bytes: 3172
use std::io;


/// https://beta.atcoder.jp/contests/arc065/tasks/arc065_a
fn main() {
    let s = read_one::<String>();
    let t = vec!["eraser", "erase", "dreamer", "dream"];
    let ans = t.iter().fold(s, |s, x| s.replace(x, ""));
    if ans.is_empty() { println!("YES"); }
    else { println!("NO"); }
}


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

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

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

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

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] ND=cin.ArrayInt(2,0);
        int D=ND[1]*2+1;
        int N=ND[0];
        if(N%D!=0){N/=D;N++;}
        else N/=D;
        Console.WriteLine(N);
        
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}



Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = c - a, y = d - b;
  printf("%d %d %d %d\n ", c - y, d + x, a - y, b + x);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define all(c) (c).begin(), (c).end()
#define endl '\n'
// auto start = high_resolution_clock::now(); 
// auto stop = high_resolution_clock::now(); 
// auto duration = duration_cast<microseconds>(stop - start); 
 
// cout << duration.count() << endl; 


int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
//      int t;
//      cin >> t; 
//      while(t--){
     	
// }

int n;
cin >> n;

vi v(n+1);
for(int i = 0;i <= n;i++)v[i] = i;
fo(i,0,n+1){
	if(i%3 == 0)v[i] = 0;
	else if(i%5 == 0)v[i] = 0;
}

for(int i = 1;i <= n;i++){
	v[i] += v[i-1];
}
cout << v[n] << endl;





return 0;
}


Measured memory_bytes: 11012