akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int to_int(char c) {
  return c- 48;
}

int main() {
  string s;
  cin >> s;
  int min = abs(to_int(s.at(0)) * 100 + to_int(s.at(1)) * 10 + to_int(s.at(2)) -753);
  for(int i = 1;i < s.size() - 2;i++) {
    if(abs(to_int(s.at(i)) * 100 + to_int(s.at(i + 1)) * 10 + to_int(s.at(i + 2)) -753) < min) {
      min = abs(to_int(s.at(i)) * 100 + to_int(s.at(i + 1)) * 10 + to_int(s.at(i + 2)) -753);
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
using namespace std;
long long INF = 1000000009;
map<int, int> mp;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	int sum = 0;
	cin >> n;
	int tmp = n;
	while (tmp > 0) {
		sum += tmp % 10;
		tmp /= 10;
	}
	if (n % sum == 0) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n,k; cin>>n>>k;
  VI v(n); rep(i,n) cin>>v[i];

  ll ans = 0;

  rep(a,min(n,k)+1){
    rep(b,min(n,k)-a+1){
      vector<ll> c; ll cnt = 0;
      rep(i,a) c.PB(v[i]), cnt+=v[i];
      rep(i,b) c.PB(v[n-i-1]), cnt+=v[n-i-1];
      sort(ALL(c));
      rep(i,min(k-a-b,(int)c.size())){
        if(c[i]<0) cnt-=c[i];
      }
      ans = max(ans,cnt);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ALL(n) n.begin(),n.end()
const ll MOD=1000000007;
const long double PI=3.14159265358979;

int main() {
  ll x1,y1,x2,y2,dx,dy;
  cin>>x1>>y1>>x2>>y2;
  dx=x1-x2;
  dy=y1-y2;
  cout<<x2+dy<<" "<<y2-dx<<" "<<x1+dy<<" "<<y1-dx;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	}
}

Measured memory_bytes: 22740
#include<iostream>
#include<vector>
#include <climits>

using namespace std;

int main(){
    int n,l; cin >> n >> l;
    int v[n],max = INT_MAX;
    int sum = 0;

    for(int i = 0; i < n; i++){
        v[i] = abs(l+i);
        if(abs(max) > v[i]){
            max = l+i;
        }
        sum += l+i;
    }

    cout << sum - max << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int main() {

    vector<int> n;
    for (int i = 0; i < 4; ++i) {
        int a;
        cin >> a;
        n.push_back(a);
    }
    sort(n.begin(),n.end());
    if(n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int m, f, r;
    int sum=0;
    for(;scanf("%d%d%d",&m,&f,&r);)
        
    {
        if(m== -1 && f == -1 && r == -1)
            break;
        else if(m<=50 && f<=50 && r<=100)
        { sum=m+f;
            if(m == -1 || f == -1 || m+f<30)
                printf("F\n");
            else if(sum >= 80)
                printf("A\n");
            else if(sum >= 65 && sum<80)
                printf("B\n");
            else if(sum >= 50 && sum<65)
                printf("C\n");
            else if(sum >= 30 && sum<50 && r >= 50)
                printf("C\n");
            else if(sum >= 30 && sum<50)
                printf("D\n");
        }
    }
    
    return 0;
}



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

int main() {
	int N, A;
	cin >> N >> A;
	int x[53];
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
		sum += x[i];
	}
	long long dp[53][2550][53] = { 0 };
	dp[0][0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int k = 0; k <= N; k++) {
			for (int j = 0; j <= sum; j++) {
				if (j >= x[i]) {
					dp[i + 1][j][k] = dp[i][j - x[i]][k - 1] + dp[i][j][k];
				}
				else {
					dp[i + 1][j][k] = dp[i][j][k];
				}
			}
		}
	}
	long long combi;
	combi = 0;
	int n = 0;
	n = sum / A;
	for (int i = 1; i <= N; i++) {
			combi += dp[N][i*A][i];
	}
	cout << combi;
	return 0;
}

Measured memory_bytes: 56192
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll dp[44][410][410];

int main(){
  ll n,m1,m2;
  cin>>n>>m1>>m2;
  vector<pair<ll,pair<ll,ll> > > v;
  rep(i,0,n){
    ll a,b,c;
    cin>>a>>b>>c;
    v.pb(mp(a,mp(b,c)));
  }
  rep(i,0,44)rep(j,0,410)rep(k,0,410)dp[i][j][k]=1000000000000LL;
  dp[0][0][0] = 0;
  rep(i,1,n+1){
    rep(k,0,405){
      rep(l,0,405){
        rep(j,0,2){
          dp[i][min(403LL,k+v[i-1].fi*j)][min(403LL,l+v[i-1].se.fi*j)] = min(dp[i][min(403LL,k+v[i-1].fi*j)][min(403LL,l+v[i-1].se.fi*j)],dp[i-1][k][l]+v[i-1].se.se*j);
        }
      }
    }
  }
  ll ans = 1000000000000LL;
  rep(i,1,1000){
    if(m1*i>402||m2*i>402)break;
    ans = min(ans,dp[n][m1*i][m2*i]);
  }
  if(ans==1000000000000LL)cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}
 

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

int n, k, l[55], ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    for(int i=0; i<n; i++) cin >> l[i];
    sort(l, l+n);
    for(int i=n-1; i>=n-k; i--) ans+=l[i];
    cout << ans << '\n';

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  for(int i=1;i<10;i++){
    if(N%i==0&&N/i<10){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
// Problem : B - Multiple of 9
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    string s;
    cin>>s;
    ll sum=0;
    FOR(i,0,s.size())
    {
    	sum+=s[i]-'0';
    }
    if(sum%9==0){cout<<"Yes";}
    else
    {
    	cout<<"No";
    }
    return 0;
}



Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

ll a, b, n;

int main()
{
    cin>>n>>a>>b;
    cout<<(n / (a + b) * a + min(n % (a + b), a))<<endl;

    return 0;
}


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

#define inn(n)         int n; cin >> n;
typedef long long      ll;
typedef vector<int>    vi;
typedef pair<int, int> pi;

bool ispal(string s)
{
    string copy = s;
    reverse(s.begin(), s.end());
    if(copy==s) return true;
    else return false;
}

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

    string s; cin >> s;
    string sub1, sub2;
    int n = s.size() - 1;

    sub1 = s.substr(0, ((n-1)/2) + 1);
    sub2 = s.substr(((n+3)/2), n-((n+3)/2) + 1);

    if(ispal(s) && ispal(sub1) && ispal(sub2)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<pair<int, int>> p(n);
    for(int i=0; i<n; i++){
        cin >> p[i].first >> p[i].second;
    }
    if(n&1){
        cout << "NA" << endl;
        return 0;
    }
    int ax, ay;
    for(int i=0; i*2 < n; i++){
        int j = n/2 + i;
        if(i == 0){
            ax = p[i].first + p[j].first;
            ay = p[i].second + p[j].second;
        }
        if(ax != p[i].first + p[j].first || ay != p[i].second + p[j].second){
            cout << "NA" << endl;
            return 0;
        }
    }
    cout << fixed << setprecision(20) << 1.*ax/2. << " " << 1.*ay/2. << endl;
}



Measured memory_bytes: 3276
using System.Linq;
using System;
using System.IO;
using System.Collections.Generic;

class Program
{
  private static IEnumerable<int> Range(int start, int count)
  { return Enumerable.Range(start, count); }

  static void Main(string[] args)
  {
    string[] lines = Console.ReadLine().Split(' ');
    int a = int.Parse(lines[0]);
    int b = int.Parse(lines[1]);
    int k = int.Parse(lines[2]);

    var sw = new StreamWriter(
        Console.OpenStandardOutput()
      ) { AutoFlush = false };
      
    if(b - a < k << 1)
    {
      Range(a, b - a + 1).ToList().ForEach(sw.WriteLine);
    }
    else
    {
      Range(a, k).ToList().ForEach(sw.WriteLine);
      Range(b - k + 1, k).ToList().ForEach(sw.WriteLine);;
    }

    sw.Flush();
  }
}

Measured memory_bytes: 13268
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

using namespace std;

int h,w;
char moji[120][120];
int flag[120][120];
int kotae;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


void dfs(int x,int y){
	flag[x][y]=1;
	char now = moji[x][y];
	for(int i = 0;i<4;i++){
		int nx = x+dx[i];
		int ny = y+dy[i];
		if(nx<0 || nx>=w || ny<0 || ny >=h)continue;
		if(moji[nx][ny]==now && flag[nx][ny] == 0){
			dfs(nx,ny);
		}
	}
}

int main(){
	while(1){
		cin >> h >> w;
		if (h==0&&w==0) return 0;
		for(int i =0;i<h;i++){
			for(int j = 0;j<w;j++){
				cin >> moji[j][i];
			}
		}
		for(int i =0;i<h;i++){
			for(int j = 0;j<w;j++){
				if(flag[j][i] == 0){
					kotae += 1;
					dfs(j,i);
				}
			}
		}
		cout << kotae << endl;
		kotae = 0;
		for(int i =0;i<h;i++){
			for(int j = 0;j<w;j++){
				flag[j][i] = 0;
			}
		}
	}
}
		

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

int sum(int n) {
  int ans;
  for(int i=1; i<=n; i++) ans += i;
  return ans;
}

int main() {
  int a,b; cin>>a>>b;
  int d = sum(b-a);
  cout<<d-b;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<vector<long long>> ps(N);
  set<long long> xs;
  set<long long> ys;
  for(int i=0;i<N;++i){
    ps[i].resize(2,0);
    cin >> ps[i][0] >> ps[i][1];
    xs.insert(ps[i][0]);
    ys.insert(ps[i][1]);
  }
  long long result = (*(max_element(xs.begin(), xs.end())) - *(min_element(xs.begin(), xs.end()))) *
    (*(max_element(ys.begin(), ys.end())) - *(min_element(ys.begin(), ys.end())));
  for(auto &right : xs){
    for(auto &left: xs){
      if(left > right) break;
      for(auto &top: ys){
        for(auto &btm: ys){
          if(btm > top) break;
          int n = 0;
          for(auto &c : ps){
            if(c[0] <= right && c[0] >= left && c[1] <= top && c[1] >= btm)
              n += 1;
          }
          if(n >= K)
            result = min(result, (right - left)*(top - btm));
        }
      }
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int X, A;
	cin >> X >> A;

	if (X < A) cout << 0 << endl;
	else cout << 10 << endl;
}

Measured memory_bytes: 3656
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, m, a, b;
    ll res = 0;
    cin >> n >> m;
    map<int, vector<int>> jobs;
    multiset<int> mulset;
    for(int i=0;i<n;++i)
    {
        cin >> a >> b;
        jobs[a].push_back(b);
    }

    for(int i=1;i<=m;++i)
    {
        for(const auto& rewards : jobs[i])
        {
            mulset.insert(rewards);
        }
        
        if(!mulset.empty())
        {
            int elem = *(mulset.rbegin());
            mulset.erase(std::prev(mulset.end()));
            res += elem;
        }
    }

    cout << res << endl;
}

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

int main()
{
    int n;
    scanf("%d", &n);
    int sum;
    int tmp = n;
    while (n>0)
    {
        sum += n%10;
        n /= 10;
    }
    if (tmp%sum == 0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Name        : Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define ff first
#define ss second
#define endl '\n'
#define INF 1e9 + 1
#define _INF INT32_MIN
#define pq priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
set<LL> aa;
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL gcd(LL a,LL b) {
	return !b ? a : gcd(b, a % b);
}
LL LCM(LL a, LL b) {
	return (a*b) / gcd(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		//printf("%d ", 2);
		aa.insert(2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			//printf("%d ", i);
			aa.insert(i);
			n /= i;
		}
	}
	if (n > 2){
		//printf("%d ", n);
		aa.insert(n);
	};
}
bool is_square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
LL power(LL x, LL y)
{
	LL temp;
	if (y == 0)return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp*temp;
	else return x*temp*temp;
}
bool is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	LL n, m;
	cin >> n >> m;
	set<LL>a;
	for (int i = 1; i <= sqrt(m); i++) {
		if (m % i == 0) {
			a.insert(i);
			a.insert(m / i);
		}
	}
	LL ans = 1;
	for (auto itr = a.begin(); itr != a.end(); itr++) {
		if (*itr*n <= m) {
			ans = *itr;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def examA():
    K, X = LI()
    if K*500>=X:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)
    return

def examB():
    N = I()
    S = SI()
    ans = 0
    for i in range(N-2):
        if S[i:i+3]=="ABC":
            ans +=1
    print(ans)
    return

def examC():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()


Measured memory_bytes: 3700
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
typedef pair<int,int> pii;

inline bool IN(int x, int y, int w, int h)
{
    return 0 <= x && x < w && 0 <= y && y < h;
}


int main()
{
	int n;
	vi pn(1000000,1);
pn[0]=0;
pn[1]=0;
for(int i=2;i<=1000000/2;i++){
	if(pn[i]==1){
		for(int j=2;j<=1000000/i;j++){
			pn[j*i]=0;
		}
	}
}
	while(cin >> n){
		int ans=0;
		rep(i,n+1){
			if(pn[i])ans++;
		}
		cout << ans << endl;
	}


}

Measured memory_bytes: 4900
macro_rules! input {
     (source = $s:expr, $($r:tt)*) => {
         let mut iter = $s.split_whitespace();
         input_inner!{iter, $($r)*}
     };
     ($($r:tt)*) => {
         let s = {
             use std::io::Read;
         let mut s = String::new();
         std::io::stdin().read_to_string(&mut s).unwrap();
         s
     };
     let mut iter = s.split_whitespace();
     input_inner!{iter, $($r)*}
     };
}
     
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
 
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        n: usize,
        d: usize,
        points: [[i32; d]; n],
    }
    let mut ans = 0;
    for i in 0..(n - 1) {
        for j in (i + 1)..n {
            if is_square(points[i].iter().zip(points[j].iter())
                         .map(|(ci, cj)| (ci - cj).pow(2))
                         .sum()
                         ) { ans += 1; }
        }
    }
    println!("{}", ans);
}

type PositiveInt = i32;
fn is_square(n: PositiveInt) -> bool {
    n == ((n as f64).sqrt().floor() as PositiveInt).pow(2)
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

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

  if (a+b==15) {
    cout << "+" << endl;
  } else if (a*b==15) {
    cout << "*" << endl;
  } else {
    cout << "x" << endl;
  }
  
  return 0;
}


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

bool isprime(int x){
 if(x==2){
	return true;
 }
 if(x<2 ||x%2==0){
	return false;
 }
 for(int i=3;i*i<=x;i+=2){
	if(x%i==0){
		return false;
 	}
 }
 return true;
}

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

 int cnt=0;

 for(int i=0;i<n;i++){
	int x;
	cin>>x;

	if(isprime(x)){
		cnt++;
	}
 }
 cout<<cnt<<endl;

 return 0;
}

Measured memory_bytes: 3088
/* divisor.cpp
    整数の約数を列挙するアルゴリズム
*/

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

/*  divisor(n)
    入力：整数 n
    出力：nのすべての約数
    計算量：O(√n)
*/
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long 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.begin(), ret.end());
    return ret;
}

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    auto div = divisor(c);
    int ans = 0;
    for (auto i : div) {
        if (a <= i && i <= b) {
            ans++;
        }
    }
    cout << ans << endl;
}



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

using ll = long long;
ll dp[3100][3100][4];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int r, c, k;
  cin >> r >> c >> k;
  
  vector<vector<ll>> item(r, vector<ll>(c));
  for (int i = 0; i < r + 100; i++) {
    for (int j = 0; j < c + 100; j++) {
      for (int ii = 0; ii < 4; ii++) {
        dp[i][j][ii] = 0;
      }
    }
  }
  
  for (int i = 0; i < k; i++) {
    ll x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    item[x][y] = z;
  }
  
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      for (int ii = 0; ii < 4; ii++) {
        if (item[i][j] == 0) {
          dp[i][j + 1][ii] = max(dp[i][j + 1][ii], dp[i][j][ii]);
          dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][ii]);
        }
        else {
          dp[i][j + 1][ii] = max(dp[i][j + 1][ii], dp[i][j][ii]);
          dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][ii]);
          if (ii < 3) {
            dp[i][j + 1][ii + 1] = max(dp[i][j + 1][ii + 1], dp[i][j][ii] + item[i][j]);
            dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][ii] + item[i][j]);
          }
        }
      }       
    }
  }
  
  ll ans = 0;
  for (int i = 0; i <= r; i++) {
    for (int j = 0; j <= c; j++) {
      for (int ii = 0; ii < 4; ii++) {
        ans = max(ans, dp[i][j][ii]);
      }       
    }
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 374068
def main():
    H,W,A,B = map(int, input().split())
    
    for i in range(H):
        if i < B:
            print("1"*A + "0"*(W-A))
        else:
            print("0"*A + "1"*(W-A))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3956
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  string s;cin>>s;
  if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}


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

using namespace std;

bool bad[11];

bool check(int x) {
  while(x > 0) {
    if(bad[x % 10]) return false;
    x /= 10;
  }
  return true;
}

int main() {
  int n, k; cin >> n >> k;
  for(int i = 0; i < k; i++) {
    int x; cin >> x;
    bad[x] = 1;
  }
  while(true) {
    if(check(n)) {
      return !printf("%d\n", n);
    }
    n = n + 1;
  }
}

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

#define rep(i, n)     for (int i = 0; i < n; ++i)
#define rep1(i, n)    for (int i = 1; i < n + 1; ++i)
#define repN(i, m, n) for (int i = m; i < n; ++i)
#define repR(i, n)    for (int i = n - 1; i >= 0; --i)

using namespace std;

int main() {
	long k;
	cin >> k;

	if (k % 2 == 0 || k % 5 == 0) {
		cout << "-1";
	} else {
		int flag    = 0;
		int count   = 1;
		long long t = 7;
		while (1) {
			if (t % k == 0) {
				break;
			} else {
				if (flag || t / k != 0) {
					flag = 1;
					t -= t / k * k;
				}
				++count;
				t = 10 * t + 7;
			}
		}
		cout << count;
	}

	return 0;
}


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

using namespace std;

struct Block {
    int a, b, x;
    friend istream& operator>>(istream& in, Block& block) {
        int s, t;
        in >> s >> t >> block.x;
        block.a = 2*s-1-2*block.x;
        block.b = 2*t-1-2*block.x;
        return in;
    }
};

bool first_start(const Block& b1, const Block& b2) {
    return vector<int>{b1.a, b1.b, b1.x} < vector<int>{b2.a, b2.b, b2.x};
}

bool first_end(const Block& b1, const Block& b2) {
    return vector<int>{b1.b, b1.a, b1.x} < vector<int>{b2.b, b2.a, b2.x};
}

bool first_x(const Block& b1, const Block& b2) {
    return vector<int>{b1.x, b1.a, b1.b} < vector<int>{b2.x, b2.a, b2.b};
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<Block> blocks(n);
    for (auto& block : blocks) {
        cin >> block;
    }
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_a(first_start);
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_b(first_end);
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_x(first_x);
    blocks_by_a.insert(blocks.begin(), blocks.end());
    while (q --> 0) {
        int d;
        cin >> d;
        d *= 2;
        while (blocks_by_a.size() > 0 && blocks_by_a.begin()->a < d) {
            blocks_by_b.insert(*blocks_by_a.begin());
            blocks_by_x.insert(*blocks_by_a.begin());
            blocks_by_a.erase(blocks_by_a.begin());
        }
        while (blocks_by_b.size() > 0 && blocks_by_b.begin()->b < d) {
            blocks_by_x.erase(*blocks_by_b.begin());
            blocks_by_b.erase(blocks_by_b.begin());
        }
        if (blocks_by_x.size() == 0) {
            cout << -1 << "\n";
        } else {
            cout << blocks_by_x.begin()->x << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 28672
#include <stdio.h>
#include <cmath>
#include <algorithm>
 
int main(){
    int n,tmp,count = 0,limit;
    scanf("%d",&n);
 
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&tmp);
        limit = sqrt(tmp);
        for(int j = 2; j <= limit; j++){
            if(tmp%j==0){
                count++;
                break;
            }
        }
    }
    printf("%d\n",n-count);
}


Measured memory_bytes: 2716
// problem: "https://atcoder.jp/contests/abc160/tasks/abc160_d"

#include<bits/stdc++.h>

using namespace std;

void bfs(vector<int>G[],int p,vector<vector<int>>&V)
{
    queue<int>Q;
    Q.push(p);
    V[p][p] = 0;

    while(!Q.empty())
    {
        int i = Q.front();
        Q.pop();

        int j;
        for(j=0;j!=G[i].size();j++)
            if(V[p][G[i][j]] == -1)
            {
                V[p][G[i][j]] = V[p][i]+1;
                Q.push(G[i][j]);
            }
    }
}

int main()
{
    int n,x,y;
    cin>>n>>x>>y;

    vector<int>G[n+1];
    int i;
    for(i=1;i!=n;i++)
    {
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }

    G[x].push_back(y);
    G[y].push_back(x);

    vector<vector<int>>V(n+1,vector<int>(n+1,-1));
    for(i=1;i!=n+1;i++)
        bfs(G,i,V);     // define

    vector<int>C(n,0);
    int j;
    for(i=1;i!=n+1;i++)
        for(j=1;j!=n+1;j++)
            C[V[i][j]]++;

    for(i=1;i!=n;i++)
        cout<<C[i]/2<<'\n';

    return 0;
}


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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int mx=0,a[n];
    for(int i=0; i<n; i++){
    	cin >> a[i];
    	mx=max(mx, a[i]);
    }
    sort(a, a+n);
    int mid=mx/2;
    int m=0;
    for(int i=16; i>=0; i--){
    	if((m+(1<<i))<n && (a[m+(1<<i)]<=mid)){
    		m+=(1<<i);
    	}
    }
    int tmp=abs(a[m]-(mx-a[m]));
    if(m+1<n && abs(a[m+1]-(mx-a[m+1]))<tmp){
    	cout << mx << " " << a[m+1];
    }
    else cout << mx << " " << a[m];
    return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int main()
{   speed;
    map< string,int > m;
    int n;cin>>n;
    string s;
    int maxi=-1;
    while(n--)
    {   cin>>s;
        m[s]++;
    }
    for(auto itr=m.cbegin();itr!=m.cend();++itr)
    {
        if(itr->second>maxi)
        {   maxi=itr->second;
        }
    }
    for(auto itr=m.cbegin();itr!=m.cend();++itr)
    {
        if(itr->second==maxi)
        {   
            cout<<itr->first<<endl;
        }
    }
}

Measured memory_bytes: 23808
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
var n = +input.shift();
var nums = input.shift().split(' ').map(Number);
var swapTimes = 0;

function bubbleSort(numbers) {
  for (var i = 0; i < numbers.length; i++) {
    for (var j = numbers.length; j > i; j--) {
      if (numbers[j] < numbers[j - 1]) {
        var tmp = numbers[j];
        numbers[j] = numbers[j - 1];
        numbers[j - 1] = tmp;
        swapTimes++;
      }
    }
  }

  console.log(numbers.join(' '));
  console.log(swapTimes);
}

bubbleSort(nums);

Measured memory_bytes: 15684
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;
 
signed main(){

    int n,x;
    while(cin>>n>>x,n){
        int ans=0;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x){
                        ans++;
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
 
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    ll tmp[5] = {};
    for(int i = 0; i < N; i++) {
        string S;
        cin >> S;
        if(S[0] == 'M') tmp[0]++;
        if(S[0] == 'A') tmp[1]++;
        if(S[0] == 'R') tmp[2]++;
        if(S[0] == 'C') tmp[3]++;
        if(S[0] == 'H') tmp[4]++;
    }
    ll ans = 0;
    for(int i = 0; i < 3; i++) {
        for(int j = i + 1; j < 4; j++) {
            for(int k = j + 1; k < 5; k++) ans += tmp[i] * tmp[j] * tmp[k];
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
typedef pair<int,int> pii;
const int mod = (int) 1000000007;
const int inf = (int) 2e18;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  cout << fixed << setprecision(9);
	#ifdef LOCAL_DEFINE
		freopen("in.txt", "rt", stdin);
	#endif
  // code
  int n;
  cin >> n;
  vector<int> arr(n);
  for(int i=0; i<n; i++) cin >> arr[i];
  vector<int> suffix(n, 0);
  suffix[n-1] = arr[n-1];
  for(int i=n-2; i>=0; i--) suffix[i] = suffix[i+1] + arr[i];
  int res = 0;
  for(int i=0; i<n-1; i++){
    res = (res + ((arr[i] % mod) * (suffix[i+1] % mod)) % mod) % mod;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 6308
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	int ans = 700;
	string s;
	cin >> s;
	for (int i = 0;i < 3;i++) {
		if (s[i] == 'o')ans += 100;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;
typedef unsigned long long ull;

#define F first
#define S second
#define en end()
#define bg begin()
#define rev reverse
#define mp make_pair
#define pb push_back
#define y1 y1234567890
#define um unordered_map
#define all(x) x.bg, x.en
#define sqr(x) ((x) * (x))
#define sz(x) (int)x.size()

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;
const double pi = acos(-1.0);
const double eps = (double)1e-9;

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 500500;

ll n, a, b, c, d;

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//cin.tie(NULL);
	//cout.tie(NULL);
	//ios_base::sync_with_stdio(false);

	cin >> n >> a >> b >> c >> d;

	for (int i = 0; i < n; i++) {
		ll l1(a + c * i);
		ll r1(a + d * i);
		ll l2(b + c * (n - i - 1));
		ll r2(b + d * (n - i - 1));
		ll l(max(l1, l2));
		ll r(min(r1, r2));
		if (l <= r) {
			cout << "YES";
			return 0;
		}
	}

	cout << "NO";

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

//一部改良したけどマルパクリすんません
var n int
var numOf753 = [3]int{3, 5, 7}
var count = 0

func dfs(v int) {
	if isContains(v, 3) && isContains(v, 5) && isContains(v, 7) {
		count++
	}
	for _, next := range numOf753 {
		tmp := v*10 + next
		//if v is equal to over n, break.
		if tmp > n {
			continue
		}
		dfs(tmp)
	}
}

// firstofall,loop {3,5,7}
// if 3, then do loop 3o. o is {3,5,7}
// so every time change a number, the number has a loop of list{3,5,7}
func main() {
	fmt.Scan(&n)
	for _, v := range numOf753 {
		dfs(v)
	}
	fmt.Println(count)
}

func isContains(n, d int) bool {
	s := strconv.Itoa(n)
	flg := false
	for i := 0; i < len(s); i++ {
		c, _ := strconv.Atoi(string(s[i]))
		if c == d {
			flg = true
		}
	}
	return flg
}

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

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q;
    cin>>n>>q;
    vector<ll> v(n);
    cinv(v,0,n);
    ll tmp=0;
    for(ll i=n-1; i>=(ll)0; i-=2){
      tmp+=v[i];
    }
    vector<ll> ans(0);
    ans.push_back(tmp);

    FOR(i,1,(n+1)/2){
      tmp = tmp + v[n-1-i] - v[n-2*i-1];
      ans.push_back(tmp);
      //cout<<tmp<<endl;
    }
    vector<ll> flag(0);//(n+1)/2個ある
    FOR(i,1,(n+1)/2){
      ll x = v[n-1-i] + v[n-2*i-1];
      x = x/2 + 1;
      //cout<<x<<endl;
      flag.push_back(x);
    }
    reverse(ans.begin(), ans.end());
    reverse(flag.begin(), flag.end());
    //coutv(ans,0,ans.size());
    //coutv(flag,0,flag.size());
//    cout<<flag[0]<<endl;

    FOR(i,0,q){
      if(n==2)break;
      ll in;
      cin>>in;

      ll l=0;
      ll r=flag.size()-1;
      while(r-l > 1){
        ll mid = (r+l)/2;
        if(flag[mid]<=in) l = mid;
        else r = mid;
      }
//      cout<<"l="<<l<<" r="<<r<<endl;
      ll res = l;
      if(flag[l]<=in && in<flag[r])res=r;
      else if(flag[r]<=in) res=r+1;

      if(flag.size()==1){
        if(flag[0]<=in) res=1;
        else res=0;
      }

      cout<<ans[res]<<endl;
    }
    if(n==2){
      FOR(i,0,q){
        ll in;
        cin>>in;
        cout<<v[1]<<endl;
      }
    }
}


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


def read():
    K = int(input().strip())
    S = input().strip()
    return K, S


def binom_preprocess(n, MOD=10**9+7):
    f = [0 for i in range(n+1)]  # n!
    invf = [0 for i in range(n+1)]  # (n!)^-1
    f[0] = 1
    f[1] = 1
    invf[0] = 1
    invf[1] = 1
    for i in range(2, n+1):
        f[i] = f[i-1] * i % MOD
    invf[n] = pow(f[n], MOD-2, MOD)
    for i in range(n, 2, -1):
        invf[i-1] = invf[i] * i % MOD
    return f, invf


def binom(n, k, f, invf, MOD=10**9+7):
    if n < k or n < 0 or k < 0:
        return 0
    else:
        return (f[n] * invf[k] % MOD) * invf[n-k] % MOD


def solve(K, S, MOD=10**9+7):
    T = len(S)
    f, invf = binom_preprocess(K+T+1)
    ans = 0
    for i in range(K+1):
        ans += pow(25, i, MOD) * binom(T-1+i, i, f, invf, MOD) * pow(26, K-i, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


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

int main()
{
    int a[10000];
    int count;
    for (count = 0; count < 10000; count++) {
        int x;
        cin >> x;
        if (x == 0) break;
        a[count] = x;
    }

    for (int j = 0; j < count; j++) {
        cout << "Case " << j+1 << ": " << a[j] << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  bool can = true;
  for (int i=0; i<n; i++) {
	int a;
    cin >> a;
    if (a%2 == 1) continue;
    if (a%3 == 0 || a%5 == 0) continue;
    can = false;
  }
  if (can) cout << "APPROVED";
  else cout << "DENIED";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("/");
        int year = Integer.parseInt(s[0]);
        int month = Integer.parseInt(s[1]);
        int date = Integer.parseInt(s[2]);

        String result = "TBD";
        if (year <= 2019 && month <= 4 && date <= 30) {
            result = "Heisei";
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 21076
import java.util.*;

public class Main {
    private static Scanner scanner;

    public static int[] inputIntArray(int n) {
        int[] res = new int[n];
        for (int i = 0; i < n; ++i) {
            res[i] = scanner.nextInt();
        }

        return res;
    }

    public static void main(String args[]) {
        scanner = new Scanner(System.in);
        while(true){
        int n = scanner.nextInt();
            
            if(n == 0) {
                return;
            }
        
        int[] arr = inputIntArray(n);
        
        double ave = 0;
        for(int i = 0; i < n; ++i) {
            ave += arr[i];
        }
        ave /= n;
        
        double a = 0.;
        for(int i = 0; i < n; ++i) {
            a += (arr[i] - ave) * (arr[i] - ave);
        }
        a /= n;
        
        System.out.println(Math.sqrt(a));
        }
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for(int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n;
  string s;
  cin >> n >> s;

  int max = 0, x = 0;
  re(i, n) {
    if(s[i] == 'I') x++;
    else x--;
    if(x > max) max = x;
  }
  cout << max << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)


  val M = in.next().toInt

  var ans = (M-1).toLong
  var over = 0L // 繰越し
  for (_ <- 1 to M) {
    val d, c = in.next().toLong

    ans += c - 1
    var now = d * c + over

    while (now >= 10) {
      val num = now / 10
      ans += num

      now = now % 10 + num
    }

    over = now
  }

  // val a = new Array[Int](N)

  println(ans)
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.deep))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 49312
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

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

    vector<pair<ll,int>> fs;
    for(ll i=2;i*i<=n;++i){
        int x=0;
        while(n%i==0){
            n/=i;
            ++x;
        }
        fs.emplace_back(i,x);
    }
    if(n!=1)fs.emplace_back(n,1);

    int ans=0;
    for(auto p:fs){
        int x=p.second;
        int b=1;
        while(b<=x){
            x-=b;
            b++;
            ++ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 19676
#include <iostream>
#include <string>
#include <cmath>
#define rep(i,n) for (int i = 0; i<(n); i++)
using namespace std;
using P = pair<int,int>;
#include <vector>
#include <algorithm>

int main(){
    int a, b;
    cin>>a>>b;
    cout<<a*b;
}

Measured memory_bytes: 3184