akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

#define MAX 110000


int main() {
	int n;
	cin >> n;
	vector<int> dp(MAX, n);
	dp[0] = 0;
	for (int i = 1; i < n + 1; i++) {
		for (int pow6 = 1; pow6 <= i; pow6 *= 6) {
			dp[i] = min(dp[i], dp[i - pow6] + 1);
		}
		for (int pow9 = 1; pow9 <= i; pow9 *= 9) {
			dp[i] = min(dp[i], dp[i - pow9] + 1);
		}
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <limits.h>

int main(void) {
	int num, i, k;
	int M[100][100];
	int g[100], h[100], gn;
	int weight, minimum, index, a;

	scanf("%d", &num);
	for (i = 0; i < num; i++) {
		g[i] = 1;
		h[i] = 0;
		for (k = 0; k < num; k++) {
			scanf("%d", &M[i][k]);
		}
	}

	h[0] = 1;
	g[0] = 0;
	gn = num - 1;
	weight = 0;

	while (gn--) {
		minimum = INT_MAX;

		for (k = 0; k < num; k++) {
			if (!h[k])
				continue;

			for (i = 0; i < num; i++) {
				if (!g[i])
					continue;

				a = M[k][i];
				if (0 <= a && a < minimum) {
					index = i;
					minimum = a;
				}
			}
		}
		h[index] = 1;
		g[index] = 0;
		weight += minimum;
	}
	printf("%d\n", weight);
	return 0;
}

Measured memory_bytes: 640
import java.io.*;
import java.util.*;

public class Main {

	void submit() {
		int x = nextInt();
		int y = nextInt();
		if (x % y != 0) {
			out.println(x);
		} else {
			out.println(-1);
		}
	}

	void preCalc() {

	}

	void stress() {

	}

	void test() {

	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}


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

int is_palindrome(string s) {
  return equal(s.begin(), s.begin() + s.length() /2, s.rbegin());
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int len = s.size();
    int m = ((len+3)/2)-1;
    if( len%2 == 0)
        cout<< "No";
    else{
        if(!is_palindrome(s))
            cout << "No";
        else if(!is_palindrome(s.substr(0, (len-1)/2)))
            cout << "No";
        else if(!is_palindrome((s.substr(m, len))))
            cout << "No";
        else
            cout <<"Yes" ;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ss second
#define ff first
#define Mem(x,val) memset(x,val,sizeof x)
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
#define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "\n"
#define debug(a,b) cerr << #a<<" = "<<a<<"   |   "<<#b<<" = "<<b<<'\n'
#define endl '\n'
#define SZ(a) ((int)a.size())
using namespace std;
typedef pair<int, int> pi32;
typedef pair<ll, ll> pi64;
typedef vector<int> vi32;
typedef vector<ll> vi64;
typedef vector<pi32> vp32;
typedef vector<pi64> vp64;
const ll mod = 1e9 + 7;
const int MX = 1e4+7;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	cin>>n;
	cout<<n+n*n+n*n*n<<endl;
	
	return 0;
}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

class UnionFind {
    vector<int> parent;

    public:
        UnionFind(int size) {
            parent = vector<int>(size, -1);
        }

        int find(int x) {
            if (parent[x] < 0) {
                // parent itself
                return x;
            } else {
                return parent[x] = find(parent[x]);
            }
        }

        bool unite(int x, int y) {
            int rX, rY;
            if ((rX = find(x)) == (rY = find(y))) {
                // already united
                return false;
            }
            if (size(rX) < size(rY)) {
                int tmp = rX;
                rX = rY;
                rY = tmp;
            }
            parent[rX] += parent[rY];
            parent[rY] = rX;
            return true;
        }

        int size(int x) {
            return -parent[find(x)];
        }

        bool isSame(int x, int y) {
            return find(x) == find (y);
        }
        
        int component_count() {
            int c = 0;
            for (const int x : parent) {
                if (x < 0) {
                    c++;
                }
            }
            return c;
        }
};

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        y[i] = x[i];
    }
    sort(ALL(y));
    vector<int> m{y[n / 2 - 1], y[n / 2]};

    for (const int v : x) {
        if (v < m[1]) {
            cout << m[1] << endl;
        } else {
            cout << m[0] << endl;
        }
    }
}


Measured memory_bytes: 3712
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



int N,M,Q;
vector<int> a,b,c,d;
int ans;


void dfs(vector<int> A) {

  if(A.size() == N+1) {
    int now = 0;
    rep(i,Q) if(A[b[i]] - A[a[i]] == c[i]) now += d[i];
    ans = max(ans,now);
    return; 
  }

  A.push_back(A.back());
  while(A.back() <= M) {
    dfs(A);
    A.back()++;
  }
  
}


int main() {
  cin >> N >> M >> Q;
  a=b=c=d=vector<int>(Q);
  rep(i,Q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int>(1,1));

  cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll L, R, d; cin >> L >> R >> d;
  ll result = R/d - (L-1)/d;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#define N 100

int main(void){
  
  int i,j,mini,n,tmp,counter=0;
  int A[N];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<n;i++){
    mini = i;
    for(j=i;j<n;j++){
      if(A[j]<A[mini]){
	mini = j;
      }
    }
    tmp = A[i];
    A[i] = A[mini];
    A[mini] = tmp;
    if(mini!=i) counter++;
  }
  
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1){
      printf(" ");
    }
  }
  printf("\n");
  printf("%d\n",counter);
  
  return 0;
}

Measured memory_bytes: 604
#include<stdio.h>
int main()
{
    long long int n,temp,rem,counter,a,b,sum;
    while(scanf("%lld %lld",&a,&b)==2)
    {
        counter=0;
        sum=a+b;
        while(sum!=0)
        {
            rem=sum%10;
            sum/=10;
            counter++;
        }
        printf("%lld\n",counter);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N;
  cin >> N;
  N--;
  vector<int> C(N), S(N), F(N);
  rep(i, 0, N) { cin >> C[i] >> S[i] >> F[i]; }

  rep(i,0,N+1){
    int ans=0;
    rep(j,i,N){
      chmax(ans,S[j]);
      ans+=(F[j]-abs(ans-S[j])%F[j])%F[j];
      ans+=C[j];
    }
    cout<<ans<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T> T in(){T x;cin>>x;return x;}
// long long a = in<long long>();
template<class T> vector<T> inarr(int s,int e, T init){
	vector<T> v;T x;
	for(int i=0;i<s;++i)v.push_back(init);
	for(int i=s;i<e;++i){cin>>x;v.push_back(x);}
	return v;
}
// vi P = inarr<int>(0,N,0);
// vi P = inarr<int>(1,N+1,INT_MAX);
// vs P = inarr<string>(0,N,"");
template<class T>void outarr(int s,int e,vector<T> &V){
	for(int i=s;i<e;i++)cout<<V[i]<<(i<e-1?" ":"\n");
}
// outarr<int>(0,V.size(),V);

int N;
vvi A(3,vi(3));
vi B;

auto solve(){
	// rp(i,0,3) outarr<int>(0,3,A[i]);//
	// cout<<N<<"\n";//
	// outarr<int>(0,B.size(),B);//

	rp(i,0,N){
		rp(r,0,3)rp(c,0,3){
			if(A[r][c] == B[i]){
				A[r][c] = 0;
				if((A[0][0]==0 && A[1][1]==0 && A[2][2] == 0)
				|| (A[0][2]==0 && A[1][1]==0 && A[2][0] == 0)
				|| (A[0][0]==0 && A[0][1]==0 && A[0][2] == 0)
				|| (A[1][0]==0 && A[1][1]==0 && A[1][2] == 0)
				|| (A[2][0]==0 && A[2][1]==0 && A[2][2] == 0)
				|| (A[0][0]==0 && A[1][0]==0 && A[2][0] == 0)
				|| (A[0][1]==0 && A[1][1]==0 && A[2][1] == 0)
				|| (A[0][2]==0 && A[1][2]==0 && A[2][2] == 0)
				){
					return "Yes";
				}
			}
		}
	}

	return "No";
}

int main(){

	rp(i,0,3){
		// A[i] = inarr<int>(0,N,0);
		rp(j,0,3) cin>>A[i][j];
	}
	cin>>N;
	B = inarr<int>(0,N,0);

	cout<< solve() <<endl;
}


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

using namespace std;

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

  bool success = false;
  for (int i = 0; i <= n; i++) {
	for (int j = 0; j <= m; j++) {
	  int val = i * m + j * n - 2 * i * j;
	  if (val == k) success = true;
	}
  }
  if (success) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import sys
from collections import deque

s = list(sys.stdin.readline().rstrip())
q = int(sys.stdin.readline())
head = 0
s = deque(s)

for _ in range(q):
    query = sys.stdin.readline().split()
    if len(query) == 1:
        head = 1 if head == 0 else 0
    elif (query[1] == '1' and head == 1) or (query[1] == '2' and head == 0):
        s.append(query[2])
    else:
        s.appendleft(query[2])

if head == 1:
    s.reverse()

print(''.join(s))


Measured memory_bytes: 70520
def hate?(v, hates)
  return hates[v] if v < 10
  return true if hates[v % 10]

  hate?(v / 10, hates)
end

def solve(n, k, d)
  hates = Array.new(10)
  d.each {|i| hates[i] = true}

  (0..Float::INFINITY).lazy
    .map{|i| n + i }
    .find { |i| !hate?(i, hates) }
end

def main
  stdin = STDIN.gets
  nk = stdin.split(/\s/)
  n = nk[0].to_i
  k = nk[1].to_i
  stdin = STDIN.gets
  d = stdin.split(/\s/).map!(&:to_i)

  puts solve(n, k, d)
end

main

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

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

using namespace std;
using ll=long long;

const int INF = 100000;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    ll cnt, rest, res;
    cnt = N / (A + B);
    rest = N % (A + B);
    if (rest > A) {
        rest = A;
    }
    res = A * cnt + rest;
    cout << res;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int k = sc.nextInt();
		Set<String> sub = new HashSet<>();
		for(int i = 0; i < s.length(); i++) {
			sub.add(s.substring(i, i + 1));
			if(i + 1 < s.length())
				sub.add(s.substring(i, i + 2));
			if(i + 2 < s.length())
				sub.add(s.substring(i, i + 3));
			if(i + 3 < s.length())
				sub.add(s.substring(i, i + 4));
			if(i + 4 < s.length())
				sub.add(s.substring(i, i + 5));
		}
		List<String> list = new ArrayList<>();
		list.addAll(sub);
		Collections.sort(list);
		System.out.println(list.get(k - 1));
	}

}


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

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

    if(n==1) ans = 1.0;
    else if(n%2==0) ans = 0.5;
    else if(n%2==1) ans = (n/2+1.0)/(double)n;

    printf("%.8f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

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

void solve(){
	string str;
	cin >> str;
	cout << str.substr(0, 3) << endl;
}

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


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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

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

    char b; cin >> b;
    char out;
    switch(b) {
        case 'A':
            out = 'T';
            break;
        case 'C':
            out = 'G';
            break;
        case 'G':
            out = 'C';
            break;
        case 'T':
            out = 'A';
            break;
    }

    cout << out << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
	Scanner sc = new Scanner(System.in);
        double a=sc.nextDouble();
        double b=a*a*Math.PI;
        double c=2*a*Math.PI;
	System.out.printf("%f %f",b,c);
       
    }
}


Measured memory_bytes: 28240
#include <iostream>

using namespace std;

int main() {
    int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
    long long less = min(x,y);
    long long cost = 0;
    if((a+b)/2.0 > c) {
        cost += min(x,y)*c*2;
    } else {
        cost += min(x,y)*(a+b);
    }
    x -= less;
    y -= less;
    if(x == 0 && y == 0){
        cout << cost << endl;
        return 0;
    }
    if(x > 0) {
        if(a < c*2){
            cost += a*x;
        } else {
            cost += c*2*x;
        }
    }
    if(y > 0) {
        if(b < c*2){
            cost += b*y;
        } else {
            cost += c*2*y;
        }
    }
    cout << cost << endl;
    //case1 avg(a,b) > c
    //case2 avg(a,b) <= c
    //case3 a < c && x > y
    //case4 b < c && x < y
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  string ans="No";
  if(s<t){
    ans="Yes";
  }
  cout << ans;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  string s[110];
  int h, w;
  cin >> h >> w;
  for (int i = 1; i <= h; i++) cin >> s[i];
  for (int i = 0; i <= h+1; i++) {
    if (i == 0 || i == h+1) {
      for (int j = 0; j <= w+1; j++) cout << '#';
      cout << endl;
    }
    else cout << "#" << s[i] << "#" << endl;
  }

}


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

int is(int a){
	int i, l=sqrt(a);
	if(l*l==a) return 0;
	if(a==2) return 1;
	if(a%2==0) return 0;
	for(i=3; i<l; i+=2){
		if(a%i==0) return 0;
	}
	return 1;
}

int main(void){
	int x;
	scanf("%d", &x);
	while(!is(x++));
	printf("%d\n", x-1);
}



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

int main() {
  string s, t;
  cin >> s >> t;
  map<char,char> cs, ct;
  int n = sz(s);
  bool ok = true;
  for (int i = 0; i < n; i++) {
    char x = s[i], y = t[i];
    if (cs.count(x)) if (cs[x] != y) ok = false;
    if (ct.count(y)) if (ct[y] != x) ok = false;
    cs[x] = y;
    ct[y] = x;
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 776
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if (L[i] != L[j] and L[j] != L[k] and L[k] != L[i]) and (L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                ans += 1
print(ans)

Measured memory_bytes: 9200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class Question5
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            //long n = long.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            var inputIntArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int N = inputIntArray[0];
            int A = inputIntArray[1];
            int B = inputIntArray[2];

            //var P = Enumerable.Range(1, 100);

            var ans = Enumerable.Range(1, N).Where(x =>
                {
                    var sum = x.ToString().Sum(y => (int)(y - '0'));
                    return A <= sum && sum <= B;
                }).Sum();


            Console.Write(ans);

            Console.Out.Flush();

        }
    }
}


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

int a, b, c;

int main(void){
    
    scanf("%d %d %d", &a, &b, &c);
    printf("%s\n",((b - a) == (c - b)) ? "YES" : "NO");
    
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    int ans=pow(10,9);
    for(int i=-100;i<=100; i++){
        int cnt=0;
        for(int j=0; j<n; j++){
            cnt+=(i-a.at(j))*(i-a.at(j));
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3568
import scala.io.StdIn._
import Character._

object Main {
  def main(args: Array[String]) {
    def whichCharacter(c: Char): Char = {
      if(isUpperCase(c)) toLowerCase(c)
      else if(isLowerCase(c)) toUpperCase(c)
      else c
    }

    val input = readLine()
    input.foreach(i => print(whichCharacter(i)))
    print("\n")
  }
}

Measured memory_bytes: 43756
#include<bits/stdc++.h>
bool check(int a,int b,int c) {
	return a-b==b-c;
}
int main() {
	int a,b,c;
	std::cin>>a>>b>>c;
	if(check(a,b,c))std::cout<<"YES";
	else std::cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#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)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
int main(){
    string s;
    int n, cnt=0;
    cin >> n >> s;
    REP(i,n-2){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
            cnt++;
        }
    }
    cout << cnt << endl;


}

    



Measured memory_bytes: 256
from bisect import bisect_left
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

a_cs = [0] * (n + 1)
for i in range(n):
    a_cs[i + 1] = a_cs[i] + a[i]

idx = bisect_left(a_cs, x)
if idx == n + 1:
    ans = n - 1
elif a_cs[idx] > x:
    ans = idx - 1
else:
    ans = idx
print(ans)


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

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
        cin >> v.at(i);
    }
    for (int i = 0; i < N; ++i) {
        int max = i;
        for (int j = i + 1; j < N; ++j) {
            if (v.at(max) < v.at(j)) {
                max = j;
            }
        }
        int tmp = v.at(i);
        v.at(i) = v.at(max);
        v.at(max) = tmp;
    }
    int cnt = 0;
    for (int i = 1; i < N; ++i) {
        if(v.at(i - 1) == v.at(i)){
            cnt++;
        }
    }
    cout << N - cnt << endl;
}


Measured memory_bytes: 256
l, r = list(map(int, input().split()))
MOD = 2019
diff = r - l
ans = 0
if diff < 2019:
    l = l%MOD
    r = l + diff
    ans = 2018
    for i in range(l,r):
        for j in range(i+1, r+1):
            ans = min(ans, (i%MOD*j%MOD)%MOD )
      
print(ans)


Measured memory_bytes: 40812
#!/usr/bin/env python
# -*- coding: utf-8 -*-
M = 1000000007


def gcd(a, b):
  while b != 0:
    a, b = b, a % b

  return a


def comb(n):
  c = 1

  for _ in range(n):
    c = (c * 2) % M

  return c - 1


def main():
  zeros = 0
  groups = {}

  for _ in range(int(input())):
    a, b = map(int, input().split())

    if a == 0 and b == 0:
      zeros += 1
      continue

    if a == 0:
      v = (1, 0)
      i = 0
    elif b == 0:
      v = (1, 0)
      i = 1
    else:
      if b < 0:
        a = -a
        b = -b

      g = gcd(a, b)
      a //= g
      b //= g

      if a > 0:
        v = (a, b)
        i = 0
      else:
        v = (b, -a)
        i = 1

    if v not in groups:
      groups[v] = [0, 0]

    groups[v][i] += 1

  count = 1

  for k, (v1, v2) in groups.items():
    c = (comb(v1) + comb(v2) + 1) % M
    count = (count * c) % M

  count = (count - 1 + zeros) % M

  print(count)


if __name__ == '__main__':
  main()


Measured memory_bytes: 135836
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
vector<vector<int> > g;
map<pair<int,int>,int> mp;

void dfs(int a,int pre,int c){
    int p = 0;
    for(auto x:g[a]){
        if(x==pre)continue;
        if(p==c){
            p++;
        }
        mp[MP(a,x)] = p;
        mp[MP(x,a)] = p;
        dfs(x,a,p);
        p++;
    }
}


int main(){
    
    int n;
    cin >> n;
    g.resize(n);
    vector<pair<int,int> > e;
    vector<int> s(n);
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        s[a]++;
        s[b]++;
        e.push_back(MP(a,b));
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0,-1,-1);
    int k = *max_element(s.begin(),s.end());
    cout << k << endl;
    for(auto x:e){
        cout << mp[x]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 16628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
int gcd(int A,int B){
  if(A<B)
    swap(A,B);
  while(1){
    if(A%B==0)
      return B;
    int C=A%B;
    A=B;
    B=C;
  }
}
signed main(){
  int A,B; cin>>A>>B;
  int K=gcd(A,B);
  int ans=1;
  if(K==1)
    ans=1;
  else{
  while(K>1&&K%2==0){
        ans++;
      while(K%2==0)
        K/=2;
  }
  int i=3;
  while(K>1&&K>=i*i){
    if(K%i==0){
        ans++;
      while(K%i==0)
        K/=i;
    }
    else
      i+=2;
  }
  if(K>1)
    ans++;
  }
  cout<<ans<<endl;
  }





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

int main(void)
{
    int i;
    int x;
    vector<int> v;

    while (i < 10000){
        cin >> x;

        if (x == 0){
            break;
        }

        v.push_back(x);

        i++;
    }

    for (i = 0; i < v.size(); i++){
        cout << "Case " << i + 1 << ": " << v[i] << "\n";
    }

    return (0);
}


Measured memory_bytes: 3164
N, K = gets.chomp.split.map(&:to_i)

S = gets.chomp.split.map(&:to_i)

T = gets.chomp.chars

class String
  SCORE = %w[r s p].zip(S).to_h
  WIN   = { 'r' => 'p', 's' => 'r', 'p' => 's' }

  def score
    SCORE.fetch(self)
  end

  def win
    WIN.fetch(self)
  end
end

me = []
score = 0

0.upto(K - 1) do |i|
  me << T[i].win
  score += me[-1].score
end

K.upto(N - 1) do |i|
  if T[i].win != me[i - K]
    me << T[i].win
    score += me[-1].score
    next
  end

  if i + K < N
    choice = %w[r s p] - [me[i - K], T[i + K].win]
    me << choice.first
    next
  end

  me << T[i]
end

print score


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

const int N = 1e5;

int n,l;
int li[N+5];

int main(){
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++){
		scanf("%d",&li[i]);
	}
	int idx = -1;
	for(int i=1;i<n;i++){
		if(li[i]+li[i+1] >= l){
			idx = i;
			break;
		}
	}
	if(idx == -1){
		printf("Impossible\n");
		return 0;
	}
	printf("Possible\n");
	for(int i=1;i<n;i++){
		if(i==idx) break;
		printf("%d\n",i);
	}
	for(int i=n-1;i>=1;i--){
		if(i==idx) break;
		printf("%d\n",i);
	}
	printf("%d\n",idx);
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

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


const int MAX = 666668;
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;
}

int main(){
    COMinit();
    ll MOD = 1000000007;
    ll ans = 1;
    int X,Y;
    cin >> X >> Y;
    if( (X + Y) %3 != 0){
        cout << 0 << endl;
        return 0;
    }
    ll total_hop    = (X + Y) / 3;
    ll diff         = abs(X - Y);
    ll less         = (total_hop - diff) / 2;


    cout << COM(total_hop, less) % MOD << endl;

}


Measured memory_bytes: 15872
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in range(n)]
    mod_ab = sorted(ab, key=lambda x: (x[1], x[0]))
    time = 0

    for ai, bi in mod_ab:
        time += ai

        if time > bi:
            print('No')
            exit()

    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 67876
#include <bits/stdc++.h>
 
#define ld long double
 
using namespace std;
 
vector <int> g[200500];
 
int add[200500];
 
int sum[200500];
 
void dfs(int v, int pr, int cur)
{
    cur += add[v];
    sum[v] += cur;
    for(int j = 0; j < g[v].size(); j++)
    {
        int to = g[v][j];
        if(to != pr)
        {
            dfs(to, v, cur);
        }
    }
}
 
int main()
{
    ios_base :: sync_with_stdio(0);
  //  cin.tie(0);
  //  cout.tie(0);
    int n,q,x,y,p;
    cin >> n >> q;
    for(int i = 0; i < n - 1; i++)
    {
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    while(q--)
    {
        cin >> p >> x;
        add[p] += x;
    }
    dfs(1, 1, 0);
    for(int i = 1; i <= n; i++) cout << sum[i] << ' ';
}

Measured memory_bytes: 27264
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    string S;
    cin >> S;
    string M,A;
    M = S.substr(0,S.size()/2);
    A = S.substr((S.size()+1)/2);
    reverse(all(A));
    int count = 0;
    REP(i,A.size()){
        if(A[i] != M[i])count++;
    }
    cout <<count<< "\n";
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args){
		
		try(
		BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
		){
			String[] str = br.readLine().split(" ");
			int A = Integer.parseInt(str[0]);
			int B = Integer.parseInt(str[1]);
			
			String postalCode = br.readLine();
			
			String reg = "\\d{" + A + "}-\\d{" + B + "}";
			if(postalCode.matches(reg)){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
		}catch(IOException e){
			e.printStackTrace();
		}
	}
}


Measured memory_bytes: 23380
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    if(b>=a)
        cout << "0";
    else
    {
        int h[a];
        int i;
        for(i=0;i<a;i++)
            cin >> h[i];
        sort(h,h+a);
        long long int sum=0;
        for(int i=0;i<a-b;i++)
            sum+=h[i];
            cout << sum;

    }
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int N, D, i;
	scanf("%d", &N);
	scanf("%d", &D);
	D = 2 * D + 1;//監視範囲
	i = N / D;
	if (N%D != 0) {
		i++;
	}
	printf("%d", i);
}

Measured memory_bytes: 128
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = write!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! eprintln {
    () => { eprintln!(""); };
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = writeln!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! dbg {
    ($v:expr) => {{
        let val = $v;
        eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
        val
    }}
}

macro_rules! mat {
    ($($e:expr),*) => { Vec::from(vec![$($e),*]) };
    ($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
    ($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
    ($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
    ($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
        $a$([$i])*.$f($($t),*)
    };
    ($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
        let t = $e;
        ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
    } };
}

pub fn readln() -> String {
    let mut line = String::new();
    ::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
    line
}

macro_rules! read {
    ($($t:tt),*; $n:expr) => {{
        let stdin = ::std::io::stdin();
        let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
            let line = line.unwrap();
            let mut it = line.split_whitespace();
            _read!(it; $($t),*)
        }).collect::<Vec<_>>();
        ret
    }};
    ($($t:tt),*) => {{
        let line = readln();
        let mut it = line.split_whitespace();
        _read!(it; $($t),*)
    }};
}

macro_rules! _read {
    ($it:ident; [char]) => {
        _read!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        Vec::from(_read!($it; String).into_bytes())
    };
    ($it:ident; usize1) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_read!($it; $t)),*)
    };
}


pub fn main() {
    let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: i64 = 1_000_000_007;
const INF: i64 = std::i64::MAX/3;

fn solve() {
    let s = read!(char);
    if s.is_uppercase(){
        println!("A");
    }
    else {
        println!("a");
    }
}

fn run() {
    solve();
}


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

int a[10010], b[10010];

int main() {
	int n;
	scanf("%d",&n);
	long long tota = 0, totb = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d",&a[i]);
		tota += a[i];	
	}
	for (int i = 0; i < n; i++) {
		scanf("%d",&b[i]);
		totb += b[i];	
	}
	long long tot = totb - tota;
	if (tot < 0) {
		printf("No\n");
		return 0;
	}
	long long cur = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] >= b[i]) continue;
		int mint = (b[i]-a[i]+1)/2;
		cur += mint;
		if (cur > tot) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <stack>
#include <queue>

using namespace std;

int main(void) {
	int n, m;
	string id;
	string U[256];
	bool opened = false, unknown;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> U[i];
	}
	cin >> m;
	for(int i = 0; i < m; i++) {
		cin >> id;
		unknown = true;
		for(int i = 0; i < n; i++) {
			if(id == U[i]) {
				cout << (opened ? "Closed by " : "Opened by ") << id << endl;
				opened = !opened;
				unknown = false;
				break;
			}
		}
		if(unknown) cout << "Unknown " << id << endl;
	}

	return 0;
}

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

long long int mod = 1e9 + 7;
long mem[4000][4000];


long combination(int n, int k) {
    if (mem[n][k])
        return mem[n][k];
    long ret = 0;
    if ((k == 0) || (n <= k)) {
        ret = 1;
    } else {
        ret = (combination(n - 1, k - 1) + combination(n - 1, k)) % mod;
    }   
 
    mem[n][k] = ret;
    return ret;
}


int main(){
	long long int N, K; cin >> N >> K;
    for (int i = 1; i <= K; i++) {
        if (i > (N - K + 1) ) { 
            cout << 0 << endl;
            continue;
        }
        long cnt = ((long) combination(K - 1, i - 1) * combination(N - K + 1, i)) % mod;
        cout << cnt << endl;
    }
	
	return 0;
}


Measured memory_bytes: 62080
def main():
    A_MX = 10 ** 6

    N = int(input())
    *A, = map(int, input().split())
    A.sort()

    ctr = [0] * (A_MX + 1)
    for x in A:
        ctr[x] += 1

    B = [0] * (A_MX + 1)

    ans = 0
    for x in A:
        if B[x]: continue
        if ctr[x] == 1:
            ans += 1
        y = x
        while y <= A_MX:
            B[y] = 1
            y += x
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
    int n, sum = 0, ans = 1;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i) cin >> a[i];
    int l = 0;
    sort(a, a+n);
    for(int i = 1; i < n; ++i) {
        if(a[i] - a[l] >= 3) {
            ans = max(ans, i-l);
            l++;
        }
    }
    ans = max(ans, n-l);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
k = 0
for i in range (N):
    if A[i]%2 == 0:
        if A[i]%3 != 0:
            if A[i]%5 != 0:
                k = 1
                break
if k == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int total = 0;
		int t = 0;
		for (int i = 1; total < x; i++) {
			total += i;
			t++;
		}
		System.out.println(t);
	}
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;
#define MAXN 200000100


int32_t main(){
	ios::sync_with_stdio(0);
	ll n;
	cin >> n;
	if(n%2==1){
		cout << 0 << endl;
		return 0;
	}
	else{
		ll ans = n/10;
		ll k = 50;
		while(k<=n) ans += n/k, k*=5;
		cout << ans << endl;
	}
}


Measured memory_bytes: 256
import sys

import numpy as np


def main():
    X = int(input())
    V = (100, 101, 102, 103, 104, 105)
    m1 = X // 100
    if m1 == 0:
        print(0)
        sys.exit()
    dp = np.full([(m1 + 1) * 105], 10**9, np.int32)
    dp[0] = 0
    for j in range(1, m1 + 1):
        for v in V:
            w = v * j
            p_dp = dp.copy()
            np.minimum(dp[w:], p_dp[:-w] + w, out=dp[w:])

    if X in dp:
        print(1)
    else:
        print(0)


main()


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

using namespace std;

// DP時の道具
template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		// aよりbの方が小さかったら、aの値をbの値に置き換える
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		// aよりbの方が大きかったら、aの値をbの値に置き換える
		a = b;
		return true;
	}
	return false;
}


int main() {
	int N, W;
	cin >> N >> W;
	vector<long> w(N);
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> w.at(i) >> v.at(i);
	}

	// 初期化
	const int MAX_V = 100000;
	const long long INF = (1LL << 62);
	vector<vector<long long>> dp(N+1, vector<long long>(MAX_V+1, INF));
	dp.at(0).at(0) = 0;

	// 更新
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= MAX_V; j++) {
			// i番目の品物を選ぶ
			if (j - v.at(i) >= 0) {
				chmin(dp.at(i+1).at(j), dp.at(i).at(j - v.at(i)) + w.at(i));
			}

			// i番目の品物を選ばない
			chmin(dp.at(i+1).at(j), dp.at(i).at(j));
		}
	}

	// 出力
	long long ans = MAX_V;
	while (dp.at(N).at(ans) > W) {
		ans--;
	}
	cout << ans << endl;
}


Measured memory_bytes: 80256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int N, A, B;
vector<int> hps;

bool enough(int T) {
    int s = 0;
    for (auto h : hps) {
        int t = h - B * T;
        if (t <= 0) continue;
        s += ceil((double)t / (A - B));
        if (s > T) return false;
    }
    return true;
}

int main() {
    cin >> N >> A >> B;

    for (int i = 0; i < N; i++) {
        int hp;
        cin >> hp;
        hps.push_back(hp);
    }

    int l = 1;
    int r = *max_element(hps.begin(), hps.end()) / B + 1;
    while (l <= r) {
        int m = (l + r) / 2;
        if (enough(m))
            r = m - 1;
        else
            l = m + 1;
    }
    cout << l << endl;

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  string s; cin >> s;
  int n=s.size();
  int left=0, right=0;
  rep(i,0,n){
    if(s[i]=='S') left++;
    else{
      if(left>0){
        left--;
      }else{
        right++;
      }
    }
  }
  cout << right+left << endl;
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
void swap(int *a,int *b);

int main(){
  int *a,i,j,x,f,temp,cnt=0;
  scanf("%d",&x);
  a=malloc(sizeof(int)*(x+1));
  for(i=0;i<x;i++){
    scanf("%d",&a[i]);
  }
  //バブルソート
  for(i=0;i<x-1;i++){
    for(j=x-1;j>i;j--){
      if(a[j]<a[j-1]){
        swap(&a[j],&a[j-1]);
        cnt++;
      }
    }
  }
  //表示
  for(i=0;i<x-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[x-1]);
  printf("%d\n",cnt);
  return 0;
}
void swap(int *a,int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}



Measured memory_bytes: 2144
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int box[100001],cnt[100001];
int main(void)
{
	int n,k,q,a,i;
	scanf("%d %d %d",&n,&k,&q);
	for(i=1;i<=n;i++){
		box[i]=k;
		cnt[i]=0;
	}
	for(i=0;i<q;i++){
		scanf("%d",&a);
		cnt[a]++;
	}
	for(i=1;i<=n;i++){
		box[i]=box[i]-(q-cnt[i]);
	}
	for(i=1;i<=n;i++){
		if(box[i]<=0){
			printf("No\n");
		}
		else{
			printf("Yes\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)

int32_t main() { 
    boost;
    int a,b,n;
    cin>>n;
    cin>>a>>b;
    int tt = a/n;
    if(a%n !=0)
    	tt++;
    tt = tt*n;
    if(tt>=a && tt<=b)
    	cout<<"OK"<<endl;
    else
    	cout<<"NG"<<endl; 
}


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

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

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();
    let x: u32 = read();

    let mut ans = 0;

    for i in 0..a + 1 {
        for j in 0..b + 1 {
            for k in 0..c + 1 {
                if 500 * i + 100 * j + 50 * k == x {
                    ans += 1;
                }
            }
        }
    }

    println!("{}", ans)
}


Measured memory_bytes: 2088
#include <iostream>

using namespace std;
 unsigned long long a[100005],b,n,i,p,x,p18;

int main()
{
    cin>>n;
  p18=1000000000000000000;


    for(i=1; i<=n; i++)
    {
        cin>>a[i];
        if(!a[i])
        {
            cout<<0;
            return 0;
        }

    }
    p=1;
    for(i=1; i<=n; i++)
    {
        x=a[i];
        if(x>p18/p)
        {
            cout<<-1;
            return 0;
        }
        p*=x;

    }
   cout<<p;
    return 0;
}


Measured memory_bytes: 4400
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <cmath>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define INF 1000000000+10
#define MOD (1000000000+7)
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	if(abs(n-m) > 1) {cout << "0" << endl; return 0;}
	long long f[100000+3];
	f[0] = 1; f[1] = 1;
	int t = n>m? n:m;
	int y = n>m? m:n;
	FOR(i, 2, t+1) f[i] = (f[i-1] * i) % MOD;
	//cout << f[2] << " ";
	long long ans = 0;
	if(t == y){
		ans = 2 * f[t] * f[t] % MOD;
	}else{
		ans = f[t] * f[y] % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024