akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	string s; cin >> s;
	vector<int> alpha(26,0);

	REP(i,s.size()){
		alpha[s[i]-'a']++;
	}

	REP(i,26){
		if(alpha[i] == 0){
			cout << (char)(i+'a') << endl;
			return 0;
		}
	}

	cout << "None" << endl;
	return 0;

}


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

int main() {
  int N, a, b, j;
  cin >> N;

  int c = 0;
  int s = 0;
  int i = 8;
  
  while (i >= 0){
    a = 1;
    for (j=0; j<i; j++){
      a *= 10;
    }
    
    b = (N - c) / a;
    c += b * a;
    s += b;
    i--;
  }
  
  if (N % s == 0){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>a>>b;
  for(int i=b-a+1;i<=b+a-1;i++)
  cout<<i<<" ";
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
dp = [float('INF')]*(N+1)
dp[0] = 0
for i in range(1,N+1):
    dp[i] = dp[i-1]+1
    num6,num9 = 6,9
    while 0<=i-num6<=N:
        dp[i] = min(dp[i],dp[i-num6]+1)
        num6 *= 6
    while 0<=i-num9<=N:
        dp[i] = min(dp[i],dp[i-num9]+1)
        num9 *= 9
print(dp[-1])


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

bool check (string s){
  int n = s.length();
  if (n%2==1){
    return false;
  }
  else {
    return (s.substr(0,n/2-1)==s.substr(n/2));
  }
}

int choise_sort (int n, int a[]){
  int index;
  for (int i=0; i<n-1; i++){
    int min = a[i], num;
    for (int j=i; j<n-1; j++){
      if (a[j+1]<min){
        min = a[j+1];
        num = j+1;
      }
    }
    index = a[i];
    a[i] = min;
    a[num] = index;
  }
}

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

  d = x%10;
  x /= 10;
  c = x%10;
  x /= 10;
  b = x%10;
  x /= 10;
  a = x%10;

  for (int i=-1; i<2; i+=2){
    for(int j=-1; j<2; j+=2){
      for (int k=-1; k<2; k+=2){
        int ans = a+(b*(-1*i))+(c*(-1*j))+(d*(-1*k));
        if (ans==7){
          cout << a;
          if (-1*i>=0) cout << "+";
          else cout << "-";
          cout << b;
          if (-1*j>=0) cout << "+";
          else cout << "-";
          cout << c;
          if (-1*k>=0) cout << "+";
          else cout << "-";
          cout << d;
          cout << "=7" << endl;
          return 0;
        }
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<int> am(N),bm(N);
    rep(i,N)cin >> am[i];
    rep(i,N)cin >> bm[i];
    ll res = 0;
    for(int k=29;k>=0;k--){
        //vector<int> am(N),bm(N);
        ll T =(1<<k);
        rep(i,N){
            am[i]=am[i]%(2*T);
            bm[i]=bm[i]%(2*T);
        }
        sort(All(bm));

        ll is_one = 0;
        rep(i,N){
            int add = 0;
            if(am[i]<=T){
                add += lower_bound(All(bm),(2*T)-am[i])-lower_bound(All(bm),T-am[i]);
            }else{
                //add += lower_bound(All(bm),(1<<(k+1)))-bm.begin();
                //add -= lower_bound(All(bm),(3*(1<<k))-a[i])-lower_bound(All(bm),(1<<(k+1))-a[i]);
                add+=lower_bound(All(bm),(2*T)-am[i])-bm.begin();
                add+=lower_bound(All(bm),(2*T))-lower_bound(All(bm),(3*T)-am[i]);
            }
            is_one+=add;
        }
        if(is_one&1)res+=T;
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  int cust,to,lastmonth[1001] = {0},thismonth[1001] = {0};
  string s;
  while(getline(cin,s)) {
    to = s.find(",");
    if(atoi(s.substr(0,to).c_str()) == 0) break;
    lastmonth[atoi(s.substr(0,to).c_str())]++;
  }
  while(getline(cin,s)) {
    to = s.find(",");
    thismonth[atoi(s.substr(0,to).c_str())]++;
  }
  for(int i=0;i<1001;i++) {
    if((thismonth[i] >= 1) && (lastmonth[i] >= 1)) {
      cout << i << " " << lastmonth[i] + thismonth[i] << endl;
    }
  }

}

Measured memory_bytes: 0
#include <iostream>
#include <map>
using namespace std;
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

int T[100000];
int main() {
  int N, C, K; scanf("%d%d%d", &N, &C, &K);
  for (int i{0}; i < N; ++i) {
    scanf("%d", &T[i]);
  }
  sort(T, T + N);

  int total{0};
  int i{0};
  while (i < N) {
    int count{1};
    int t = T[i];
    for (++i; i < N && T[i] == t; ++i) ++count;
    for (; count % C != 0 && i < N && T[i] <= t + K; ++i) ++count;
    total += (count + (C - 1)) / C;
  }

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


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int ans = 0;
        for (int i = 0; i < s.length; i++) {
            if (s[i] != t[i]) {
                ans++;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 41820
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int n;
	cin >> n;
	vl num(5);
	string march = "MARCH";
	rep(i, n) {
		string s;
		cin >> s;
		rep(j, 5) {
			if (s[0] == march[j]) {
				num[j]++;
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				ans += num[i] * num[j] * num[k];
			}
		}
	}
	cout << ans << endl;
}

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

typedef struct{
    long long b;
    long long c;
}card_t;

long long max(long long A,long long B){
    return A>B?A:B;
}

long long min(long long A,long long B){
    return A<B?A:B;
}

int asort(const void *A,const void *B){
    return *(long long*)A>*(long long*)B?1:0;
}

long long lowerbound(long long Key,long long Array[],long long Max){
    long long Min=0;
    if (Array[Max-1]<Key){
        return Max;
    }
    while (Max-Min>1){
        long long Mid=Min+(Max-Min)/2;
        if(Array[Mid]<Key){
            Min=Mid;
        } else {
            Max=Mid;
        }
    }
    return Array[Min]<Key?Max:Min;
}

int strsort(const void *A, const void *B){
    long long P=((card_t*)A)->c-((card_t*)B)->c;
    long long Q=((card_t*)A)->b-((card_t*)B)->b;
    if (P!=0){
        return -P;
    } else if (Q!=0){
        return -Q;
    } else {
        return 0;
    }
}

int main(void){
    int n,m;
    scanf("%d%d",&n,&m);
    long long a[n],ans=0;
    card_t card[m];
    for (int i=0; i<n; i++){
        scanf("%lld",&a[i]);
    }
    qsort(a,n,sizeof(long long),asort);
    for (int i=0; i<m; i++){
        scanf("%lld%lld",&card[i].b,&card[i].c);
    }
    qsort (card,m,sizeof(card_t),strsort);
    
    int count=0;
    for (int i=0; i<n; i++){
        if (count==m){
            break;
        } else if (card[count].b>0 && card[count].c>a[i]){
            a[i]=card[count].c;
            card[count].b--;
        } else if (card[count].b==0){
            count++;
            i--;
        } else {
            break;
        }
    }
    
    for (int i=0; i<n; i++){
        ans+=a[i];
    }
    printf("%lld\n",ans);
    return 0 ;
}

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

int main()
{
	int N, Si[4] = {0,0,0,0};
	std::string S;
	std::cin >> N;
	for (int i = 0; i < N; i++)
	{
		std::cin >> S;
		if (S == "AC") Si[0]++;
		if (S == "WA") Si[1]++;
		if (S == "TLE") Si[2]++;
		if (S == "RE") Si[3]++;
	}
	std::cout << "AC x " << Si[0] << std::endl;
	std::cout << "WA x " << Si[1] << std::endl;
	std::cout << "TLE x " << Si[2] << std::endl;
	std::cout << "RE x " << Si[3] << std::endl;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N,T;
  cin >> N >> T;
  vector<int> t(N);
  rep(i,N) cin >> t[i];
  ll sum = 0;
  rep(i,N-1)
  {
    if(t[i+1]-t[i]>=T) sum += T;
    else sum += t[i+1]-t[i];
  }
  cout << sum + T << endl;
  return 0;
}


Measured memory_bytes: 3976
#pragma GCC optimize("O3")
#pragma GCC target("sse4.2")
 
#include <cstdio>
#include <unordered_map>
#include <deque>
#include <algorithm>
using namespace std;
typedef int key;
 
int main(){
	int r,c,n;
	scanf("%d%d%d",&r,&c,&n);
	unordered_map<key,deque<pair<key,long long>>>m;
	for(;n;n--){
		int s1,s2,d;
		scanf("%d%d%d",&s1,&s2,&d);
		m[s1].emplace_back(s2+r,d);
		m[s2+r].emplace_back(s1,-d);
	}
	for(;!m.empty();){
		long long a=-1LL<<61,b=1LL<<61;
		auto s=m.begin()->first;
		deque<pair<key,long long>>st={{s,0}};
		unordered_map<key,long long>memo={{s,0}};
		for(;!st.empty();){
			auto p=*st.begin();st.pop_front();
			auto cur=p.first;long long d=p.second;
			if(cur<=r)a=max(a,d);
			else b=min(b,d);
			for(auto &e:m[cur]){
				if(memo.find(e.first)==memo.end()){
					st.emplace_back(e.first,d+e.second);memo[e.first]=d+e.second;
				}else if(memo[e.first]!=d+e.second){
					puts("No");
					return 0;
				}
			}
		}
		if(a>b){
			puts("No");
			return 0;
		}
		for(auto &e:memo)m.erase(m.find(e.first));
	}
	puts("Yes");
}

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


int main(void)
{
	int N = 0, Y = 0;
	cin >> N >> Y;

	int res10000 = -1, res5000 = -1, res1000 = -1;
	for (int a = 0; a <= N; ++a)
	{
		for (int b = 0; b + a <= N; ++b)
		{
			int c = N - a - b;
			int total = 10000 * a + 5000 * b + 1000 * c;
			if (total == Y)
			{
				res10000 = a;
				res5000 = b;
				res1000 = c;
			}
		}
	}

	cout << res10000 << " " << res5000 << " " << res1000 << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int N, Y, i, j, k;
  scanf("%d%d", &N, &Y);
  for(i=0; i<=N; i++){
    for(j=0; j<=N-i; j++){
      for(k=0; k<=N-i-j; k++){
        if(i*10000 + j*5000 + k*1000 == Y && i+j+k == N){
          printf("%d %d %d", i, j, k);
          return 0;
        }
      }
    }
  }
  if(i==N+1) printf("%d %d %d", -1, -1, -1);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
#include <math.h>
#include <functional>

#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007
const int MAXN = 1005;
const int MAXV = MAXN * (MAXN - 1)/2;

int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
int id[MAXN][MAXN]; 
vector<int> to[MAXV];

int toId(int i, int j) {
	if (i > j) swap(i, j);
	return id[i][j];
}

vector<int> topology;
bool used[MAXV];
bool perm[MAXV];
int dp[MAXV];
bool notDAG;
void dfs(int x) {
	if (perm[x]) {
		return;
	}
	if (used[x]) {
		notDAG = true;
		return;
	}
	used[x] = true;
	Fe(it, to[x]) {
		dfs(it);
	}
	used[x] = false;
	topology.push_back(x);
	perm[x] = true;
	return;
}

int main() {
	ll n;
	cin >> n;
	vector<vector<int>> v(n, vector<int>(n - 1));
	vector<int> kita(n);
	vector<vector<int>> graph(n);
	rep(i, n) {
		rep(k, n - 1) {
			int tmp;
			cin >> tmp;
			v[i][k] = tmp -1;
		}
	}
	int V = 0;
	rep(i, n)rep(j, n) {
		if (i < j) {
			id[i][j] = V++;
		}
	}
	rep(i, n) {
		rep(j, n - 1) {
			v[i][j] = toId(i, v[i][j]);
		}
		rep(j, n - 2) {
			to[v[i][j]].push_back(v[i][j + 1]);
		}
	}
	rep(i, V) {
		dfs(i);
	}
	reverse(topology.begin(), topology.end());
	rep(i, MAXV)
		dp[i] = 0;
	Fe(it, topology) {
		Fe(itt, to[it]) {
			dp[itt] = max(dp[itt], dp[it] + 1);
		}
	}
	int m = 0;
	rep(i, MAXV)
		m = max(dp[i], m);
	if (notDAG)
		cout << -1 << endl;
	else
		cout << m + 1 << endl;
	

}



Measured memory_bytes: 40692
#pragma GCC optimize(2)

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f;

typedef long long ll;

int n;

struct node
{
	int a, b;
};

node da[maxn];

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

bool cmp(node x, node y)
{
	if(x.b != y.b)return x.b < y.b;
	else return x.a < y.a;
}

int main()
{
	n = read();
	for(int i = 1; i <= n; i ++)
	{
		da[i].a = read();
		da[i].b = read();
	}
	
	sort(da + 1, da + n + 1, cmp);
	/*
	for(int i = 1; i <= n; i ++)
	{
		cout << da[i].a << " " << da[i].b << endl;
	}
	*/
	int time = 0;
	
	for(int i = 1; i <= n; i ++)
	{
		if(time + da[i].a <= da[i].b)time += da[i].a;
		else 
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
ld n,s[100],t[100],x,y,ans;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i]>>t[i];
    }
    for(int i=0;i<360;i++){
        x=0.0,y=0.0;
        for(int j=0;j<n;j++){
            if(cos(i*M_PI/180)*s[j]+sin(i*M_PI/180)*t[j]>0){
                x+=s[j],y+=t[j];
            }
        }
        ans=max(ans,x*x+y*y);
    }
    cout<<setprecision(15)<<sqrt(ans)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  init();
  ll N, A, B;
  cin >> N >> A >> B;
  if (N == 1) {
    COUT("Hello World");
  } else {
    COUT(A + B);
  }
  return 0;
}

Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;

# define INF ((int)(1<<30))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12

template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,-1,1,0 }, dy[4] = { 1,0,0,-1 };

bool hoge[50000] = {};
vector<int> f;
void pri()
{
	for (int i = 2; i < 50000; i++)
	{
		if (hoge[i] == false)
		{
			f.push_back(i);
			for (int j = i; j < 50000; j += i)
			{
				hoge[j] = true;
			}
		}
	}
}

int main()
{
	pri();
	int m;
	double  a, b;
	while (cin >> m >> a >> b&&m)
	{
		double ans = 0;
		int p, q;
		for (int i = 0; i < f.size(); i++)
		{
			for (int j = 0; j < f.size(); j++)
			{
				if (f[i] * f[j]>m || (double)f[i] / f[j] < a / b)break;
				if((double)f[i] / f[j]>1.0)continue;
				if (f[i] * f[j]>ans)
				{
					ans = f[i] * f[j];
					p = f[i];
					q = f[j];
				}
			}
		}
		cout << p << " "<<q << endl;
	}
}

Measured memory_bytes: 3332
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, l;
int ta, mu = INF, rin;

signed main() {
	cin >> n >> l;
	for (int i = 1; i <= n; i++) {
		mu = min(mu, abs(i + l - 1));
		if (mu == abs(i + l - 1))rin = i + l - 1;
		ta += i + l - 1;
	}
	cout << ta - rin << endl;
}

Measured memory_bytes: 256
N, = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
if 0 in A:
    print(0)
    exit()
ans = 1
for x in A:
    ans *= x
    if ans > 10 ** 18:
        print(-1)
        exit()

print(ans)


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

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

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

    vector<vector<int>> A(5,vector<int>(110));
    REP(i,2){
        REP(j,N){
            cin >> A[i][j];
        }
    }

    int dp[5][110] = {0};

    dp[0][0] = A[0][0];

    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++){
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + A[i + 1][j]);
            dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + A[i][j + 1]);
        }
    }
    cout << dp[1][N-1] << endl;

    return 0;
}


Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] str = reader.readLine().split(" ");
		int N = Integer.parseInt(str[0]);
		int K = Integer.parseInt(str[1]);
		int Q = Integer.parseInt(str[2]);
		int[] kaisuu = new int[N];
		int[] score = new int[N];

		for (int i = 0; i < Q; i++) {
			String line = reader.readLine();
			int num = Integer.parseInt(line) - 1;
			kaisuu[num]++;
		}
		for (int i = 0; i < N; i++) {
			score[i] = K - Q + kaisuu[i];
			//System.out.println("score=" + score[i]);        ////////////////////
			if (score[i] > 0) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 46276
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int a,b,c,d,num1,num2,num3,num4,num5,num6;
  cin >> a >> b >> c >> d;
  num1=a*c;
  num2=a*d;
  num3=b*c;
  num4=b*d;
  if(num1>num2){
      num5=num1;
  }else{
      num5=num2;
  }
  if(num3>num4){
      num6=num3;
  }else{
      num6=num4;
  }
  if(num5>num6){
      cout << num5;
  }else{
      cout << num6;
  }
}

Measured memory_bytes: 3620
import heapq
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
q = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]
s = set()
for n in range(K):
    p, a, b, c = heapq.heappop(q)
    print(-p)
    if a+1 < X and ((a+1, b, c) not in s):
        s.add((a+1, b, c))
        heapq.heappush(q, (-(A[a+1] + B[b] + C[c]), a+1, b, c))
    if b+1 < Y and ((a, b+1, c) not in s):
        s.add((a, b+1, c))
        heapq.heappush(q, (-(A[a] + B[b+1] + C[c]), a, b+1, c))
    if c+1 < Z and ((a, b, c+1) not in s):
        s.add((a, b, c+1))
        heapq.heappush(q, (-(A[a] + B[b] + C[c+1]), a, b, c+1))

Measured memory_bytes: 4852
#if elseによる実装
A,B = map(int,input().split())

ans = 0
if A >= B:
    ans += A
    A -= 1
else:
    ans += B
    B -= 1

if A >= B:
    ans += A
    A -= 1
else:
    ans += B
    B -= 1

print(ans)

Measured memory_bytes: 9124
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int a,b;
        String op;
        while(true){
            a=scan.nextInt();
            op=scan.next();
            b=scan.nextInt();
            switch(op){
                case "?":
                    System.exit(0);
                    break;
                case "+":
                    System.out.println(a+b);
                    break;
                case "-":
                    System.out.println(a-b);
                    break;
                case "*":
                    System.out.println(a*b);
                    break;
                case "/":
                    System.out.println(a/b);
                    break;
            }
        }
   }
}


Measured memory_bytes: 26076
#include "stdio.h"

int main() {
    int n, a;
    scanf("%d", &n);
    a = n % 100 % 10;
    if ( a == 2 ||a ==  4 ||a ==  5 ||a ==  7 ||a ==  9) {
        printf("hon\n");
    } else if (a == 0 || a == 1 ||a ==  6 || a == 8){
            printf("pon\n");
    } else if (a == 3) {
        printf("bon\n");
    }
    return 0;
}

Measured memory_bytes: 1648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

int main() {
  int N; cin >> N;
  vi arr(N);
  rep(i,N) cin >> arr[i];

  sort(all(arr));

  ll ans = 0;
  rep(i,N) {
    rep(j,i) {
      int tmp = lower_bound(all(arr), arr[i]+arr[j]) - upper_bound(all(arr), abs(arr[i]-arr[j]));
      tmp -= min(arr[i], arr[j]) <= abs(arr[i]-arr[j]) ? 1 : 2;
      ans += max(tmp, 0);
    }
  }
  cout << ans/3 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>

i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

i64 cup(i64 xxx, i64 yyy) {//切り上げ
	return (xxx + yyy - 1) / yyy;
}

//メモリ置き場
string s;


//inputします
void input() {
	cin >> s;
}

//ライブラリ置き場

//main
int main() {
	input();
	int a = s.size();
	ff(i, 0, a) {
		cout << 'x';
	}
	return 0;
}

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

#define int long long int

signed main() {
    int n, d, a;
    cin >> n >> d >> a;
    vector<vector<int>> v;
    vector<int> c(n + 2, 0);
    for(int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        v.push_back({ x, y });
    }
    sort(v.begin(), v.end());
    int j = 0, ans = 0;
    for(int i = 0; i < n; i++) {
        while(j < n && v[j][0] - v[i][0] <= 2 * d)
            j++;
        int need = (v[i][1] - c[i] * a + a - 1) / (a);
        need = max(need, 0ll);
        ans += need;
        c[i] += need;
        c[j] -= need;
        c[i + 1] += c[i];
    }
    cout << ans;
}

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

signed main()
{
    string s;
    int hoge;
    cin >> hoge;
    char c;
    int floor = 0;
    string first;
    for(int i=0;i<hoge;++i)
    {
        cin >> c;
        s+=c;
        if(c == '(')
        {
            floor++;
        }
        else
        {
            floor--;
        }
        
        if(floor < 0)
        {
            first += '(';
            floor++;
        }
    }
    string last(floor>0?floor:0,')');
    cout << first << s <<last<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<stdio.h>
#include<iomanip>
using namespace std;
int main(){
	int n, x[1000], y[1000];
	double p1 = 0, p2 = 0, p3 = 0, pinf = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x[i];
	}
	for (int i = 0; i < n; i++){
		cin >> y[i];
	}
	for (int i = 0; i < n; i++){
		p1 += abs(x[i] - y[i]);
		p2 += pow(abs(x[i] - y[i]), 2);
		p3 += pow(abs(x[i] - y[i]), 3);
		pinf = fmax(pinf, abs(x[i] - y[i]));
	}
	p2 = sqrt(p2);
	p3 = pow(p3, 1.0 / 3);
	cout <<fixed<<setprecision(6)<< p1 << endl << p2 << endl << p3 << endl << pinf << endl;

}



Measured memory_bytes: 3468
#include <cstdio>
#include <vector>
#include <iostream>
#include <complex>
#include <algorithm>
using namespace std;
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if (cross(b, c) > 0)	return +1;	// counter clockwise
	if (cross(b, c) < 0)	return -1;	// clockwise
	if (dot(b, c) < 0)		return +2;	// c--a--b on line
	if (norm(b) < norm(c))	return -2;	// a--b--c on line
	return 0;
}
vector<P> convex_hull(vector<P> ps) {
	int n = ps.size(), k = 0;
	sort(ps.begin(), ps.end());
	vector<P> ch(2 * n);
	for (int i = 0; i < n; i++, k++) { // lower-hull
		while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
		ch[k] = ps[i];
	}
	for (int i = n-2, t = k + 1; i >= 0; k++, i--) { // upper-hull
		while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
		ch[k] = ps[i];
	}
	ch.resize(k - 1);
	return ch;
}
int main () {
	int n;
	while (cin >> n, n) {
		vector<P> points(n);
		for (int i = 0; i < n; i ++) {
			double x, y;
			scanf("%lf,%lf", &x, &y);
			points[i] = P(x, y);
		}
		cout << n - convex_hull(points).size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1292
package main

import "fmt"

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)
	a := make([][]int, n)
	for i := range a {
		a[i] = make([]int, m+1)
	}
	for i := 0; i < n; i++ {
		for j := 0; j < m+1; j++ {
			fmt.Scan(&a[i][j])
		}
	}
	counts := []int{}
	for bits := 0; bits < (1 << uint64(n)); bits++ {
		// bitsの各要素についてのループ
		var count int
		points := make([]int, m)
		for i := 0; i < n; i++ {
			// bitsのi個目の要素の状態がonかどうかチェック
			if (bits>>uint64(i))&1 == 1 {
				// 何かしらの処理
				count += a[i][0]
				for j := 1; j <= m; j++ {
					points[j-1] += a[i][j]
				}
			}
		}
		add := true
		for _, point := range points {
			if point < x {
				add = false
			}
		}
		if add {
			counts = append(counts, count)
		}
	}
	if len(counts) == 0 {
		fmt.Println(-1)
	} else {
		least := counts[0]
		for _, count := range counts {
			if count < least {
				least = count
			}
		}
		fmt.Println(least)
	}

}


Measured memory_bytes: 2348
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mod 1000000007



int main()
{
 ll n;
 cin>>n;
 ll arr[n];
 ll ans=0;
 for(ll i=0;i<n;i++)
 	cin>>arr[i];
 sort(arr,arr+n);
 ans=arr[n-1];
 ll p=1;
 for(ll i=n-2;i>=0;i--)
 {
 	if(p==n-1)
 		break;
 	ans=ans+arr[i];
 	p++;
 	if(p==n-1)
 		break;

 	ans=ans+arr[i];
 	p++;
 	if(p==n-1)
 		break;
 	
 }

 cout<<ans;




  return 0;
	
}




Measured memory_bytes: 5160
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	double R0, W0, C, R;
	while (cin >> R0 >> W0 >> C >> R, R0&&W0&&C&&R) {
		int  X = 0; double Y;
		while (1) {
			Y = (R0 + X*R - C*W0) / C;
			if (Y >= 0) {
				break;
			}
			else {
				X++;
			}
		}
		cout << X << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
/**
 * Created by zhangrunfeng on 2/17/20
 */
import java.util.Scanner;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Deque;

// Areas on the Cross-Section Diagram
public class Main {

    class Pair {
        public int startPos;
        public int volume;

        public Pair(int startPos, int volume) {
            this.startPos = startPos;
            this.volume = volume;
        }
    }

    private String str;

    public Main (Scanner sc) {
        str = sc.next();
    }

    public void compute() {
        int sum = 0;

        Deque<Integer> st = new LinkedList<>();
        Deque<Pair> pairSt = new LinkedList<>();

        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '\\') {
                st.push(i);
            } else if (str.charAt(i) == '/') {
                if (!st.isEmpty()) {
                    int leftIx = st.pop();
                    int currVol = i - leftIx;

                    sum += currVol;

                    Pair currPair = new Pair(leftIx, currVol);
                    while (!pairSt.isEmpty()) {
                        Pair pair = pairSt.peek();
                        if (currPair.startPos < pair.startPos) {
                            currPair.volume += pair.volume;
                            pairSt.pop();
                        } else {
                            break;
                        }
                    }
                    pairSt.push(currPair);
                }
            }
        }

        List<Integer> resList = new ArrayList<>();
        while (!pairSt.isEmpty()) {
            resList.add(pairSt.pop().volume);
        }
        Collections.reverse(resList);

        // Print Results
        System.out.println(sum);
        System.out.print(resList.size());
        for (int val : resList) {
            System.out.print(" " + val);
        }
        System.out.println();
    }

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


Measured memory_bytes: 29036
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

alias Job = Tuple!(int, int);

void main() {
  auto input = readln.split.to!(int[]);
  auto N = input[0], M = input[1];
  auto jobs = new Job[N]; // [A_i, B_i]
  foreach(i; 0..N) {
    input = readln.split.to!(int[]);
    jobs[i] = tuple(input[0], input[1]);
  }
  auto aMinHeap = heapify!"a[0]>b[0]"(jobs);
  auto bMaxHeap = BinaryHeap!(Job[], "a[1]<b[1]")(new Job[N]);
  foreach(i; 0..N) {
    bMaxHeap.popFront();
  }

  ulong ans = 0;
  for(int d = M-1; d >= 0; d--) {
    while(!aMinHeap.empty && aMinHeap.front[0] <= M-d) {
      bMaxHeap.insert(aMinHeap.front); aMinHeap.popFront();
    }
    if(bMaxHeap.empty) continue;
    ans += bMaxHeap.front[1];
    bMaxHeap.popFront();
  }
  ans.writeln;
}


Measured memory_bytes: 4476
#include<stdio.h>
#include<math.h>
#include <stdbool.h>

//桁数を把握する
int GetDigit(int num) {
	int digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}

int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	int *D = (int *)malloc(sizeof(int)*K);
	for (int i = 0; i < K; i++)
	{
		scanf("%d", &D[i]);
	}

	//Nを下位の桁から桁ごとにチェックしNGの場合はNをプラス１する
	bool jadge = false;
	int l, j;
	while (jadge == false) {
		//桁数を把握する
		int dig = GetDigit(N);
		int *a = (int *)malloc(sizeof(int)*dig);
		//桁ごとに分解する
		for (int i = 0; i < dig; i++)
		{
			a[i] = (int)(N / pow(10, (double)i)) % 10;
			//puts("a[i]");
			//printf("%d ", a[i]);
			//puts("\n");
		}

		int ng = 0;
		for (l = 0; l < dig; l++)
		{
			for (j = 0; j < K; j++)
			{
				if (a[l] == D[j]) {
					ng = 1;
					break;
				}
			}
			if (ng) {
				N++;
				break;
			}
		}
		if (l == dig && j == K && ng == 0) {
			jadge = true;
			//puts("N");
			printf("%d ", N);
			puts("\n");
		}
	}


	return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if ((C - 1) / B <= (A - 1) / D) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}


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

using namespace std;

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

    for (auto i = 0; i < 3; i++)
    {
        auto digit = n % 10;
        if (digit == 7)
        {
            cout << "Yes" << endl;
            return 0;
        }
        n = n / 10;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
int main(){
	char s[10];
	int a,b;
	gets(s);
	a=strlen(s);
	//printf("%d",a);
	if(a==6){
		if(s[2]==s[3] && s[4]==s[5]){
			printf("Yes");
		}
		else {
			printf("No");
		}
			return 0;
	}

	

	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 100
using namespace std;
const int w = 15;
const int h = 19;
typedef pair<int,int> P;
vector<string> mp(h);
map<P,int>M;
bool inmp(int x,int y){return 0<=x&&0<=y&&x<w&&y<h;}
bool goal(int x,int y){return (y==h||(y==h-1&&0<=x&&x<w));}

int mem[1<<20],used[1<<20];
int dfs(int x,int y,int bit){
  if(goal(x,y)) return 0;
  if(!inmp(x,y)) return INF;
  if(used[bit]++) return mem[bit];
  
  int res = INF;
  for(int i=-1;i<=1;i++)
    for(int j=-1;j<=1;j++){
      int nx = x+i;
      int ny = y+j;
      int nbit = bit;
      if(!inmp(nx,ny)||mp[ny][nx] != 'X') continue;

      vector<string>tmp = mp;
      while(inmp(nx,ny)&&mp[ny][nx]=='X'){
	mp[ny][nx] = '.';
	nbit |=1<<M[P(nx,ny)];
	nx+=i,ny+=j;
      }
      res=min(res,1+dfs(nx,ny,nbit));
      mp = tmp;
    }
  return mem[bit]=res;
}

int main(){

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

  for(int i=0,c=0;i<h;i++)
    for(int j=0;j<w;j++) if(mp[i][j]=='X') M[P(j,i)] = c++;

  int ans; 
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) if(mp[i][j] =='O') ans=dfs(j,i,0);

  cout<<(ans<INF? ans:-1)<<endl;
  return 0;
}

Measured memory_bytes: 9408
from collections import deque

N, Q = map(int, input().split())
adj = [[] for _ in range(N)]
count = [0] * N

for _ in range(N-1):
  a,b = map(int, input().split())
  adj[a-1].append(b-1)
  adj[b-1].append(a-1)
  
for _ in range(Q):
  p,x = map(int, input().split())
  count[p-1] += x

queue = deque([0])
visit = [True] * N
visit[0] = False

while queue:
  now = queue.popleft()
  for u in adj[now]:
    if visit[u]:
      count[u] += count[now]
      queue.append(u)
      visit[u] = False
print(*count)

Measured memory_bytes: 56156
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1e5+5;
struct node{
    int pos,len;
    int l,r;
} a[maxn];
bool cmp(const node p,const node q){
    if(p.r==q.r) return p.l>q.l;
    else return p.r<q.r;
}

int f[maxn],tot;
int main(){
    int n; scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d %d",&a[i].pos,&a[i].len),
        a[i].l=a[i].pos-a[i].len,
        a[i].r=a[i].pos+a[i].len;
    sort(a+1,a+n+1,cmp);
    int now_pos=-0x3f3f3f3f;
    for(int i=1;i<=n;i++)
        if(a[i].l>=now_pos) tot++,now_pos=a[i].r;
        printf("%d",tot);
}

Measured memory_bytes: 1792
#解き方が全然思いつかなかったので、少しでも再帰の書き方に慣れようと他の人の答えを参考にした
N,A,B,C = map(int,input().split())
l = []
for i in range(N):
  l.append(int(input()))

def dfs(dep,a,b,c):
    if dep == N:
        if min(a,b,c) > 0:
          #伸縮させるコストの計算
            return abs(a-A)+abs(b-B)+abs(c-C) - 30
        else:
            return 10**9
    #各A,B,Cが合成する、合成しないの4つパターンからNに対して行う 4**Nになる
    numA = dfs(dep+1,a+l[dep],b,c) + 10
    numB = dfs(dep+1,a,b+l[dep],c) + 10
    numC = dfs(dep+1,a,b,c+l[dep]) + 10
    numX = dfs(dep+1,a,b,c)
    return min(numA,numB,numC,numX)
print(dfs(0,0,0,0))

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

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

Pnum=0
Psum=0
if L[0]>=1:
    Pnum=L[0]
else:
    Psum=1-L[0]
    Pnum=1
for i in range(1,N):
    if i%2==1:
        if Pnum+L[i]<=-1:
            Pnum=Pnum+L[i]
        else:
            Psum+=(Pnum+L[i]+1)
            Pnum=-1
    else:
        if Pnum+L[i]>=1:
            Pnum=Pnum+L[i]
        else:
            Psum+=(1-Pnum-L[i])
            Pnum=1
            
Mnum=0
Msum=0
if L[0]<=-1:
    Mnum=L[0]
else:
    Msum=L[0]+1
    Mnum=-1
for i in range(1,N):
    if i%2==0:
        if Mnum+L[i]<=-1:
            Mnum=Mnum+L[i]
        else:
            Msum+=(Mnum+L[i]+1)
            Mnum=-1
    else:
        if Mnum+L[i]>=1:
            Mnum=Mnum+L[i]
        else:
            Msum+=(1-Mnum-L[i])
            Mnum=1

print(min(Psum,Msum))


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

int main() {
  int N;
  cin >> N;
  
  int64_t L0 = 2L;
  int64_t L1 = 1L;
  vector<int64_t> vec(87, 0L);
  
  vec.at(0) = L0;
  vec.at(1) = L1;
  for(int i = 2; i <= 86; i++){
    vec.at(i) = vec.at(i - 2) + vec.at(i - 1);
  }
  
  cout << vec.at(N) << endl;
}


Measured memory_bytes: 384
import * as fs from 'fs';

namespace AtCoder.abc105 {

    class ProgramB {
        args: string[];

        // 11
        // Yes

        // 40
        // Yes

        // 3
        // No
        constructor(args: string[]) {
            this.args = args;
        }

        main(): void {
            // 4 or 7
            let n: number = parseInt(this.args[0], 10);
            while (n > 0) {

                if (n % 4 === 0) {
                    console.log('Yes');
                    return;
                }
                if (n % 7 === 0) {
                    console.log('Yes');
                    return;
                }
                n -= 4;
            }
            console.log('No');


        }
    }

    const args: string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
    new ProgramB(args).main();
}

Measured memory_bytes: 7372
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	s;

	cin >> s;

	if (s == "ABC") {
		cout << "ARC" << endl;
	} else {
		cout << "ABC" << endl;
	}

	

}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define vi vector<int>
#define vii vector<vector<int>>
#define mod 1000000007
#define fo(i,n) for(int i=0;i<n;i++)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pb(x) push_back(x)
typedef long long ll;

void print_Array(int arr[],int start,int end){
    for(int i=start;i<end;i++){
        printf("%d ",arr[i]);
    }
}


int main(){
    int N;
    cin>>N;
    if(N%1000==0) cout<<0<<endl;
    else cout<<1000-(N%1000)<<endl;
}



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

int main() {
    int a;
    int b;
    int c;
 
   cin >> a >> b >> c;
  
   int bc = b - c;
  
   if(bc >= 0){
    
      cout << "delicious" << endl;
     
     
   }else{
     
     bc = -bc;
     
     if(bc<=a){
       cout << "safe" << endl;
     }else{
       cout << "dangerous" << endl;
     }
     
   }
  
  
  
  return 0;
}

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

int main() {
  int A, B,AA,AB,BB;
  cin >> A >> B;
  
  AA = A*2-1;
  AB = A+B;
  BB = B*2-1;

  if (AA > AB && AA > BB){
    cout << AA << endl;
  }
  else if(BB > AB && AA < BB){
    cout << BB << endl;
  }
  else{
    cout << AB <<endl;
  }
}

Measured memory_bytes: 256
def resolve():
    n, k = map(int, input().split())
    d = list(input().split())
    l = len(str(n))
    for i in range(n, 10 * n + 1):
        if all(c not in d for c in str(i)):
            print(i)
            return 0


if __name__ == "__main__":
    resolve()


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

#define max(x,y) ((x)<(y)?(y):(x))

struct data {
  int A;
  int B;
};

int N, T;
int dp1[3001][3001+3000];
struct data d[3001];

int cmp(const void *a, const void *b)
{
  struct data *d1 = (struct data *)a;
  struct data *d2 = (struct data *)b;
  return d1->A - d2->A;
}

void print_AB(int N)
{
  int i;

  for ( i=0; i<N; i++ )
    printf("A = %4d, B = %4d\n", d[i].A, d[i].B);
}

void print_dp1(int N, int T)
{
  int i, j;

  for ( i=0; i<N; i++ ) {
    for ( j=0; j<T+3000; j++ )
      printf("%d ", dp1[i+1][j]);
    printf("\n");
  }
}

int main()
{
  int res, i, j;
  int maxB;

  res = scanf("%d %d", &N, &T);
  for ( i=0; i<N; i++ )
    res = scanf("%d %d", &(d[i].A), &(d[i].B));
  qsort( d, N, sizeof(struct data), cmp);
#if 0
  print_AB( N );
#endif
  
  for ( i=0; i<T; i++ )
    dp1[0][i] = 0;
  for ( i=0; i<N; i++ ) {
    for ( j=0; j<=T+3000; j++ ) {
      if ( j >= d[i].A ) {
	if ((j - d[i].A) < T)
	  dp1[i+1][j] = max(dp1[i][j - d[i].A] + d[i].B, dp1[i][j]);
	else
	  dp1[i+1][j] = dp1[i+1][j-1];
      }
      else
	dp1[i+1][j] = dp1[i][j];
    }
  }
#if 0
  print_dp1(N, T);
#endif
  
  printf("%d\n", dp1[N][T+3000]);
}


Measured memory_bytes: 70524
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
  ArrayList<Integer> one = nextIntArray();
  int N = one.get(0);
  int K = one.get(1);
  ArrayList<Integer> list = nextIntArray();
  int output = 0;
  for(int i = 0; i < N; i++){
    if(list.get(i) >= K){
      output++;
    }
  }
  myout(output);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 46048