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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;



int main() {
  ll n,m;
  	ci(n>>m);
  co((3*n+m)/2)
}


Measured memory_bytes: 256
n, a, b = [int(x) for x in input().split()]

sum = 0
for x in range(1, n + 1):
    gyo_sum = 0
    x_str = str(x)
    for y in range(len(x_str)):
        gyo_sum += int(x_str[y])
    if gyo_sum >= a and gyo_sum <= b:
        sum += x

print(sum)

Measured memory_bytes: 3060
import java.util.Scanner;
import java.time.Year;
import java.util.Random;
import java.math.*;

public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();

        if(d>t*s){
        System.out.println("No");
        }else if(d<=t*s){
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 35816
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<"LBWNB    "<<x<<"---\n"
#define pb push_back
#define pii pair<int,int>
#define vii vector<int>
#define fi first
#define se second
#define mp make_pair
#define p() puts("")
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")
#define sz(x) ((int)(x).size())
#define sf(x) (sizeof(x))
using namespace std;
typedef long long ll;
typedef double db;
const int mod=998244353;
//const int mod=1e9+7;
//const int inf=1e9+7;
const int maxn=1e5+10;
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
inline ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}

int t,n,m,k;
int main(){
    scanf("%d%d",&n,&m);
    rep(i,1,m) {scanf("%d",&k);t+=k;}
    printf("%d\n",max(-1,n-t));
	return 0;
}




//const int M=1<<20;
//ll t1[M*2+5],t2[M*2+5],ans,ca[M],cb[M];
//inline void upd(int i){t1[i]=t1[i<<1]+t1[i<<1|1];t2[i]=max(t2[i<<1],t1[i<<1]+t2[i<<1|1]);}
//inline void add(int i,int v){for(t1[i+=M]+=v;i>>=1;upd(i));}
//int n,m,p,x,y,i,j;
//struct mons{int x,y,z;}a[M];
//int main(){
//	for(i=0;i<M;++i)ca[i]=cb[i]=1ll<<60;ans=-(1ll<<60);
//	scanf("%d%d%d",&n,&m,&p);
//	for(i=1;i<=n;++i)scanf("%d%d",&x,&y),ca[x]=min(ca[x],(ll)y);
//	for(i=1;i<=m;++i)scanf("%d%d",&x,&y),cb[x]=min(cb[x],(ll)y);
//	for(i=0;i<M;++i)t2[i+M]=-cb[i];for(i=M-1;i;--i)upd(i);
//	for(i=1;i<=p;++i)scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z);
//	sort(a+1,a+p+1,[&](const mons&a,const mons&b){return a.x<b.x;});
//	for(i=0,j=1;i<M;++i){
//		for(;j<=p && a[j].x<i;++j)add(a[j].y,a[j].z);
//		ans=max(ans,t2[1]-ca[i]);
//	}
//	printf("%lld\n",ans);
//	return 0;
//}


Measured memory_bytes: 3816
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {

	sc.Split(bufio.ScanWords)

	N, D := nextInt(), nextInt()
	X := make([]int, N)
	Y := make([]int, N)

	for i := 0; i < N; i++ {
		X[i], Y[i] = nextInt(), nextInt()
	}

	var count int = 0
	for i := 0; i < N; i++ {
		if D*D >= X[i]*X[i]+Y[i]*Y[i] {
			count++
		}
	}

	fmt.Println(count)

}


Measured memory_bytes: 7404
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll K;
string S;

set<char> ST;
set<string> STR;

void solve(){
    for(auto itr=ST.begin(); itr!= ST.end(); itr++){
        char buff = *itr;
        // cout << "Checking: " << buff << endl;
        rep(i,S.size()){
            if(S[i]==buff){
                rep(j,K){
                    if(i+j+1 <= S.size())
                        STR.insert(S.substr(i,j+1));
                }
            }
        }
    if(STR.size() >= K) break;
    }

    // printf("---STR---\n");
    // for(auto itr=STR.begin(); itr!= STR.end(); itr++){
    //     cout << *itr << endl;
    // }

    // printf("---ANS---\n");
    auto it=STR.begin();
    rep(i,K-1)
        it++;
    cout << *it << endl;
}

int main(){
    cin >> S >> K;

    string idx(S);
    sort(idx.begin(),idx.end());

    rep(i,idx.size())
        ST.insert(idx[i]);

    // printf("---ST---\n");
    // for(auto itr=ST.begin(); itr!= ST.end(); itr++){
    //     cout << *itr << endl;
    // }

    solve();
}


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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int K;
	cin >> K;
	int c = A + B + C;
	int max = A;
	if (max < B) {
		max = B;
	}
	if (max < C) {
		max = C;
	}
	int a = 1;
	for (int i = 0;i < K;i++) {
		a = a * 2;
	}
	c -= max;
	c += a* max;

	cout << c << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int x,happy=0;
	scanf("%lld",&x);
	int temp1;
	temp1=x/500;
	happy+=temp1*1000;
	temp1=x%500;
	happy+=(temp1/5)*5;
	printf("%lld",happy);
	return 0;
}

Measured memory_bytes: 128
x,n =map(int,input().split())
if n ==0:
    print(x)
    exit()
p =list(map(int,input().split()))
l = []
for i in range(51):
    if x-i not in p and x+i not in p:
        print(min(x-i,x+i))
        exit()
    elif x-i not in p and x+i in p:
        print(x-i)
        exit()
    elif x-i in p and x+i not in p:
        print(x+i)
        exit()

Measured memory_bytes: 9196
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int r;
	cin >> r;
	int ans = 3 * r * r;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
	string s;
	//bit
	cin>>s;
	int n=s.size();
	ll ans=0;
	for(int bit=0;bit<(1<<n);++bit){
		ll cul=0;
    	for(int i=0;i<n;++i){
			cul*=10;
			cul+=(int)(s[i]-'0');
    		if(bit&1<<i){
				ans+=cul;
				cul=0;
			}
		}	
		ans+=cul;
	}
	cout<<ans/2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = (to) - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define all(v) v.begin(), v.end()
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  string s;
  cin >> s;

  unordered_map<char, int> count;

  rep(i, s.size()) {
    count[s[i]]++;
  }

  char ans = -1;
  rep(i, 26) {
    char ch = 'a' + i;

    if(count[ch] == 0) {
      ans = ch;
      break;
    }
  }

  if(ans == -1) {
    cout << "None" << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 3712
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,k,n,zone,Hcnt,Tcnt,tern,pas,TAROU,HANAKO;
	int taro[101],cardflg[101],hana[101],allflg[201];
	while(1) {
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<100;i++) {
			taro[i]=0;
			hana[i]=0;
		}
		for(i=0;i<200;i++) allflg[i]=0;
		//tarou's card
		for(i=0;i<n;i++) {
			scanf("%d",&taro[i]);
			allflg[taro[i]]=1;
		}
		k=0;
		for(i=1;i<=n*2;i++) {
			if(allflg[i]==0) {
				hana[k]=i;
				k++;
			}
		}
		sort(taro,taro+n);
		sort(hana,hana+n);
		zone=0;
		tern=0;
		Hcnt=n;
		Tcnt=n;
		while(1) {
			//tern0==taro's tern (hana=else
			if(tern==0) {
				pas=0;
				if(zone==0) {
					for(i=0;i<n;i++) {
						if(taro[i]!=0) {
							zone=taro[i];
							taro[i]=0;
							Tcnt--;
							break;
						}
					}
				}
				else {
					for(i=0;i<n;i++) {
						if(taro[i]!=0 && taro[i]>zone) {
							zone=taro[i];
							taro[i]=0;
							pas=1;
							Tcnt--;
							break;
						}
					}
					if(pas!=1) zone=0;
				}
				tern=1;
			}
			else {
				pas=0;
				if(zone==0) {
					for(i=0;i<n;i++) {
						if(hana[i]!=0) {
							zone=hana[i];
							hana[i]=0;
							Hcnt--;
							break;
						}
					}
				}
				else {
					for(i=0;i<n;i++) {
						if(hana[i]!=0 && hana[i]>zone) {
							zone=hana[i];
							hana[i]=0;
							pas=1;
							Hcnt--;
							break;
						}
					}
					if(pas!=1) zone=0;
				}
				tern=0;
			}
			if(Hcnt==0 || Tcnt==0) break; 
		}
		TAROU=0;
		HANAKO=0;
		if(Hcnt==0) {
			for(i=0;i<n;i++) {
				if(taro[i]!=0) {
					HANAKO++;
				}
			}
		}
		else {
			for(i=0;i<n;i++) {
				if(hana[i]!=0) {
					TAROU++;
				}
			}
		}
		printf("%d\n",TAROU);
		printf("%d\n",HANAKO);
	}
	return 0;
}
	
	
	
	
	

Measured memory_bytes: 1044
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

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

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String[] counts = br.readLine().split(" ");
            int catsCount = Integer.parseInt(counts[0]);
            int catsOrDogsCount = Integer.parseInt(counts[1]);
            int hopeCatsCount = Integer.parseInt(counts[2]);

            String isCatsCountPossible = "NO";
            if (catsCount == hopeCatsCount
                    || (catsCount < hopeCatsCount && hopeCatsCount - catsCount <= catsOrDogsCount)) {
                isCatsCountPossible = "YES";
            }

            System.out.println(isCatsCountPossible);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 20820
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;


void main() {
    int n, m;
    scan(n, m);
    auto cnt = new int[](n);
    auto red = new bool[](n);
    cnt[] = 1;
    red[0] = 1;

    foreach (i ; 0 .. m) {
        int xi, yi;
        scan(xi, yi);
        xi--, yi--;
        cnt[xi]--;
        cnt[yi]++;
        if (red[xi]) red[yi] = 1;
        if (cnt[xi] == 0) red[xi] = 0;
    }

    auto ans = iota(n).count!(i => red[i]);
    writeln(ans);
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

using namespace std;

int main() {
  int n; cin >> n;
  int sum = 0;
  int cur = n;
  while(cur > 0) {
    sum += cur % 10;
    cur /= 10;
  }
  if(n % sum == 0) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;
ll const MOD = 1000000007;


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

int N;
cin >> N;
vi a(N);
rep(i,N) cin >> a[i];
sort(all(a));
cout << a[N-1] - a[0] << endl;

return 0;
}

Measured memory_bytes: 256
/* ファイル名：ITP1_4_C.c	*/
/* 内容：２つの整数 a, b と１つの演算子 op を読み込んで、a op b を計算する		*/
/* 		 op は、"+"(和)、"-"(差)、"*"(積)、"/"(商)、のみとし、					*/
/* 		 割り算で割り切れない場合は、小数点以下を切り捨てたものを計算結果とする	*/
/* include	*/
#include <stdio.h>

/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:２つの整数 a, b と１つの演算子 op を読み込んで、a op b を計算する	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	int a;		/* 整数a	*/
	int b;		/* 整数b	*/
	char op;	/* 演算子	*/
	/* 出力	*/
	int ans;	/* 計算結果	*/
	
	while(1){
		scanf("%d %c %d",&a, &op, &b);	/* 計算式の取得	*/
		
		if( op == '+' ){
			ans = a + b;	/* 演算子が"+"だった時は加算する	*/
		}
		else if( op == '-' ){
			ans = a - b;	/* 演算子が"-"だった時は減算する	*/
		}
		else if( op == '*' ){
			ans = a * b;	/* 演算子が"*"だった時は乗算する	*/
		}
		else if( op == '/' ){
			ans = a / b;	/* 演算子が"/"だった時は除算する	*/
		}
		else{
			break;		/* 演算子が上記以外("?")だった時は処理を終了する	*/
		}
		
		printf("%d\n",ans);
	}
	
	return 0;
}



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, a, b, c);
  out(min(b / a, c));
}


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

ll mod = pow(10, 9) + 7;

ll powmod(ll x, ll y) {
    ll res = 1;
    for (ll i = 0; i < y; ++i) {
        res = res * x % mod;
    }
    return res;
}
int main()
{
    ll n; cin >> n;
    ll ans = powmod(10,n);
    ans -= powmod(9, n);
    ans -= powmod(9, n);
    ans = (ans + powmod(8, n)) % mod;

    ans = (ans + mod) % mod;
    
    cout << ans << endl;


}


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

using namespace std;

using ll = long long;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);
  int n, i;
  cin >> n >> i;
  cout << n - i + 1 << "\n";
  return 0;
}



Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define ld long double
#define F first
#define S second
#define mem(v) memset(v,0,sizeof(v))
#define all(v) v.begin(), v.end()
#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(),v.rend())
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define vll vector<ll>
#define mp make_pair
#define dbg1(a) cout<<a<<"\n";
#define dbg2(a,b) cout<<a<<" "<<b<<"\n";
#define hell 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace std:: chrono;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; 
if (m == 1) {return 0;} 
while (a > 1) { ll q = a / m; ll t = m;  m = a % m, a = t; t = y; y = x - q * y; x = t; } 
if (x < 0) {x += m0;} return x; } 
inline ll add(ll a, ll b) { return (((a >= hell) ? a % hell : a) + ((b >= hell) ? b % hell : b) + hell) % hell; }
inline ll subt(ll a, ll b) { return (a - b + hell) % hell; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= hell) ? a % hell : a) * ((b >= hell) ? b % hell : b)) % hell; }
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll mylog(ll n,ll b)
{ll i = 1;ll ans = 0;
while(1)
{if(i>n/b){break;} i = i*b;ans++;}return ans;
}
bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b){
if (a.first == b.first)
{return a.second<b.second;} 
return a.first<b.first;
}
bool comparerev(const pair<ll,ll> &a,const pair<ll,ll> &b){
if(a.first == b.first)
{return a.second>b.second;}
return a.first>b.first;
}
int main()
{
	fast
	ll t = 1;
	//cin>>t;
	while(t--){
	ll n,k,d;
	cin>>n>>k;
	map<ll,ll>mm;
	while(k--)
	{
		cin>>d;
		ll no;
		while(d--)
		{
			cin>>no;
			mm[no]++;
		
		}
	} 
	ll cnt = 0;
	rep(i,1,n+1)
	{
		if(mm[i] == 0)
		{
			cnt++;
		}
	}
	cout<<cnt<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3664
#include<iostream>
using namespace std;
int count;
void ans(int a,int b,int c,int n,int s){
  if(b==s&&c==n) count++;
  if(b>s||c==n) goto END;
  for(int i=a+1;i<=9;i++) ans(i,b+i,c+1,n,s);
 END:;
}
int main(){
  int n,s;
  while(cin>>n>>s){
    if(n==0&&s==0) break;
    count = 0;
    for(int i=0;i<=9;i++) ans(i,i,1,n,s);
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
S = input()
max_len = 0

def f(S):
    for s in S:
        if s not in ('A', 'G', 'C', 'T'):
            return False
    return True

for i in range(len(S)+1):
    for j in range(i+1, len(S)+1):
        sbstr = S[i:j]
        if f(sbstr):
            if(max_len <= j-i):
                max_len = j-i
print(max_len)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, k, ans;

int main() {
	cin >> n >> k;
	
	LL m = n + 1;
	inc1(b, n) {
		ans += max(0LL, b - k) * (m / b) - (k == 0 ? 1 : 0) + max(0LL, m % b - k);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
struct SegTree {
    int N;
    vector<int> A;
    SegTree(int n) {
        N = 1; while (N < n) N *= 2;
        A.resize(2 * N);
    }
    void set(int idx, int val) {
        idx += N;
        A[idx] = val;
        idx /= 2;
        while (idx > 0) {
            A[idx] = A[2*idx+0] | A[2*idx+1];
            idx /= 2;
        }
    }
    int rangeor(int L, int R) {
        L += N, R += N;
        int ans = 0;
        while (L < R) {
            if (L & 1) ans |= A[L++];
            if (R & 1) ans |= A[--R];
            L /= 2, R /= 2;
        }
        return ans;
    }
};
int main() {
    int N; cin >> N;
    string S; cin >> S;
    SegTree st(N);
    for (int idx = 0; idx < N; idx++) {
        st.set(idx, 1 << (S[idx] - 'a'));
    }
    int Q; cin >> Q;
    while (Q--) {
        int type; cin >> type;
        if (type == 1) {
            int i; char c; cin >> i >> c;
            st.set(i - 1, 1 << (c - 'a'));
        } else {
            int l, r; cin >> l >> r;
            int b = st.rangeor(l - 1, r);
            cout << __builtin_popcount(b) << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 5020
// She is Pretty pretty!
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1e6+100;
ll dp[50][50];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        string s = to_string(i);
        dp[s[0]-'0'][s[s.size()-1]-'0']++;
    }
    ll ans = 0;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            ans += dp[i][j] * dp[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
int main(void){
  int n;
  char s[101];
  scanf("%d %s",&n,s);
  int i,j,max=0;
  for(i=1;i<n;i++){
    int count=0;
    for(char c='a';c<='z';c++){
      bool l=false,r=false;
      for(j=0;j<i;j++){
        if(s[j]==c) l=true;
      }
      for(j=i;j<n;j++){
        if(s[j]==c) r=true;
      }
      if(l&&r) count++;
    }
     if(max<count) max=count;
  }
  printf("%d",max);
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int DX[4] = {-1, 0, 1, 0};
int DY[4] = {0, -1, 0, 1};

int H, W, K;
int SX, SY;
char A[800][800];
int D[800][800];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> H >> W >> K;
  rep(y, H) {
    rep(x, W) {
      cin >> A[x][y];
      if (A[x][y] == 'S') SX = x, SY = y;
    }
  }
  rep(y, H) {
    rep(x, W) {
      D[x][y] = INF;
    }
  }
  queue<P> q;
  q.push(P(SX, SY));
  D[SX][SY] = 0;
  while (!q.empty()) {
    int x = q.front()._1, y = q.front()._2;
    q.pop();

    int d = D[x][y];
    if (d == K) continue;

    rep(k, 4) {
      int nx = x+DX[k], ny = y+DY[k];
      if (nx<0||nx>=W||ny<0||ny>=H) continue;
      if (A[nx][ny] == '#') continue;
      if (D[nx][ny] > d+1) {
        D[nx][ny] = d+1;
        q.push(P(nx, ny));
      }
    }
  }
  int m = INF;
  rep(y, H) {
    rep(x, W) {
      if (D[x][y] < INF) {
        m = min(m, x);
        m = min(m, y);
        m = min(m, W-1-x);
        m = min(m, H-1-y);
      }
    }
  }
  int steps = 1 + (m+(K-1))/K;
  cout << steps << "\n";
  return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a=0, b=0;
    string s;
    cin >> s;
    for(char i:s) if(i=='A') a++;
    else  b++;

    if(a == 0 || b==0) cout << "No" << '\n';
    else cout << "Yes" << '\n';

    return 0;
}

Measured memory_bytes: 256
<?php
    fscanf(STDIN, "%d", $n);
    $num = explode(" ", trim(fgets(STDIN)));
    for ($i = $n-1; $i > 0; $i-=2) {
        $b[] = $num[$i];
    }
    $b[] = $num[0];
    if ($n % 2) { // odd or even
        $restart = 1;
    } else {
        $restart = 2;
    }
    for ($i = $restart; $i < $n-1; $i+=2) {
        $b[] = $num[$i];
    }
    echo join(' ', $b) . "\n";
?>


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    int N,K,ANS=INF;
    cin>>N>>K;
    vector<int> Candle(N);
    rep(i,N){
        cin>>Candle[i];
    }

    for(int i=0;i<N-K+1;i++){
        int a=min(abs(Candle[i])+abs(Candle[i+K-1]-Candle[i]),abs(Candle[i+K-1])+abs(Candle[i]-Candle[i+K-1]));
        ANS=min(a,ANS);
    }

    cout<<ANS<<endl;

    return 0;
}

//a=97,z=122

Measured memory_bytes: 640
//https://qiita.com/tanakh/
#[allow(unused_macros)]
macro_rules! input {
	(source = $s:expr, $($r:tt)*) => {
		let mut iter = $s.split_whitespace();
		let mut next = || { iter.next().unwrap() }; 
		input_inner!{next, $($r)*}
	};
	($($r:tt)*) => {

		let stdin = std::io::stdin();
		let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); 
		let mut next = move || -> String{
			bytes
				.by_ref()
				.map(|r|r.unwrap() as char) 
				.skip_while(|c|c.is_whitespace()) 
				.take_while(|c|!c.is_whitespace()) 
				.collect()
			};
	input_inner!{next, $($r)*} 
	};
}

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

	($next:expr, $var:ident : $t:tt $($r:tt)*) => { 
		let $var = read_value!($next, $t); 
		input_inner!{$next $($r)*}
	}; 
}
#[allow(unused_macros)]
macro_rules! read_value { 
	($next:expr, ( $($t:tt),* )) => {
		( $(read_value!($next, $t)),* ) 
	};
	
	($next:expr, [ $t:tt ; $len:expr ]) => {
		(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
	};

	($next:expr, chars) => {
		read_value!($next, String).chars().collect::<Vec<char>>()
	};
	
	($next:expr, bytes) => {
		read_value!($next, String).into_bytes()
	};
	
	($next:expr, usize1) => { 
		read_value!($next, usize) - 1
	};

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

fn main(){
    input!{
        s : String,
    }
    let mut count0 :i64 = 0;
    let mut count1 :i64 = 0;
    for t in s.chars() {
        //println!("{}", t);
        if t == '0' {
            count0 = count0 + 1;
        } else {
            count1 = count1 + 1;
        }
    }
    
    if count0 < count1 {
        println!("{}",count0*2);
    } else {
        println!("{}",count1*2);
    }

}

Measured memory_bytes: 4352
list1=[i for i in input().split(" ")]
if "1" in list1:
    if "9" in list1:
        if "7" in list1:
            if "4" in list1:
                print("YES")
            else:
                print("NO")
        else:
            print("NO")
    else:
        print("NO")
else:
    print("NO")

Measured memory_bytes: 2940
h, w, k = map(int,input().split())
grid = [[] for x in range(h)]
for i in range(h):
    grid[i] = input()
cnt = 0
for i in range(1<<h):
    for j in range(1<<w):
        black = 0
        for p in range(h):
            for q in range(w):
                if 1&(i>>p) == 0 and 1&(j>>q) == 0 and grid[p][q] == '#':
                    black += 1
        if black == k:
            cnt += 1
print(cnt)

Measured memory_bytes: 9156
import random
dur=int(input())
c=list(map(int,input().split()))
cM=max(c)
for i in range(26):
  if c[i]==cM:M=i
d=[0]*26
for i in range(dur):
  t=0
  s=list(map(int,input().split()))
  m=-1<<64
  for j in range(26):
    alt=s[j]+c[j]*(i+1-d[j])+sum([-c[k]*(i+1-d[k]) for k in range(26)])
    if alt>m:
      m=alt
      t=j
  r=random.randint(1,1000)
  if r<30:
    print(M+1)
    d[M]=i+1
  else:
    print(t+1)
    d[t]=i+1


Measured memory_bytes: 79460
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
int n,A[55];
long long ans,pj;
long long dp[55][55][50*50+5];
int main()
{
	scanf("%d%lld",&n,&pj);
	for(int i=1;i<=n;i++)
		scanf("%d",&A[i]);
	dp[0][0][0]=1;
	for(int i=1;i<=n;i++)
		for(int k=0;k<=i;k++)
			for(int j=0;j<=pj*n;j++)
			{
				if(i-1>=k)
					dp[i][k][j]+=dp[i-1][k][j];
				if(j>=A[i] && k-1>=0)
					dp[i][k][j]+=dp[i-1][k-1][j-A[i]];
			}
	for(int k=1;k<=n;k++)
		for(int j=0;j<=pj*n;j++)
			if(j==k*pj)
				ans+=dp[n][k][j];
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 53632
#include<bits/stdc++.h>
using namespace std;
typedef		 long long int    ll;
typedef		vector<ll>      vll;
#define     fi              first
#define     se              second
#define		pb              push_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		ss              ' '
#define     pii             pair<ll,ll>
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
const double eps = 1e-8;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    map<ll,ll>mp;
    ll n;
    cin>>n;
    ll p1=7;
    if(p1%n==0)
    {
        cout<<1<<nn;
        return 0;
    }
    ll p2=10;
    ll ans=-1;
    for(ll i=2; i<1e6; i++)
    {
        p1=(p1*10)+7;
        p1%=n;
        if(p1==0)
        {
            ans=i;
            break;
        }




    }
     cout<<ans<<nn;















}


/* Final check before submit :

1. array size or integer overflow,like uninitialised 0 index.

2. Think twice,code once.check all possible counter test case.

3. Be careful about corner case! n=1?k=1? something about 0?

4. avoid stupid mistake!complexity(t/m)?precision error?submit same code twice?

5. if got WA than remember that you are missing something common.
   *** Be confident!!! who knows? may be your one step back to AC ***

*/





Measured memory_bytes: 3584
n = int(input())
ans = 0
for i in range(1, n + 1, 2):
    m = 1
    num = i
    for j in range(2, n + 1):
        cnt = 0
        while num % j == 0:
            num //= j
            cnt += 1
        m *= (cnt + 1)
    if m == 8:
        ans += 1
print(ans)


Measured memory_bytes: 2940
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>

using namespace std;

int n,C;
int d[31][31];
vector<vector<int>> c = {{},{},{}};
int ci;
vector<std::vector<long>> cc = {{},{},{}};

int main(){
cin >> n >> C;
for(int i = 1; i<=C; i++) for(int j = 1; j<=C; j++) cin >> d[i][j];
for(int i = 1; i<=n; i++){
  for(int j = 1; j<=n; j++) {
    cin >> ci;
    for (int k = 0; k<3; k++)if((i+j)%3==k) c[k].push_back(ci);
  }
}

int count = 0;
for(auto x:c){
  for(int i = 1; i<=C; i++){
    int s = 0;
    for(auto v:x){
      s += d[v][i];
    }
    cc[count].push_back(s);
  }
  count++;
}

long smin = 10000000007;
for(int i = 0; i<C;i++){
  for(int j = 0; j<C;j++){
    for(int h = 0;h<C;h++){
      if(i==j || j==h || i==h)continue;
      smin = min(cc[0][i] + cc[1][j] + cc[2][h], smin);
    }
  }
}

cout<<smin<<endl;

return 0;
}


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

int main()
{
    int m, f, b;

    cin >> m >> f >> b;

    if( b - m < 0 )
        cout << 0 << endl;
    else if( m + f < b )
        cout << "NA" << endl;
    else
        cout << b - m << endl;

    return 0;
}


Measured memory_bytes: 3124
#!/usr/bin/env python3
import sys


def solve(N: int, P: int, S: str):
    if P == 2 or P ==5:
        answer = 0
        for i in range(N):
            if int(S[i])%P == 0:
                answer += i+1
        print(answer)
        return

    amari = [0]*N
    amari[N-1] = int(S[N-1])%P
    keta = 1
    for i in range(N-2,-1,-1):
        num = pow(10,keta,P)*int(S[i])
        amari[i]=(amari[i+1]+num)%P
        keta += 1
    from collections import Counter
    counter = Counter(amari)
    answer = 0
    for _,value in counter.items():
        answer += (value*(value-1))//2
    answer += amari.count(0)
    print(answer)  
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    S = next(tokens)  # type: int
    solve(N, P, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12516
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 1e5+5;
int cnt[maxn];

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    int N,M;
    while (cin >> N >> M) {
        memset(cnt,0,sizeof(cnt));
        FOR(_,0,M) {
            int a,b; cin >> a >> b;
            cnt[a] ^= 1; cnt[b] ^= 1;
        }
        bool ans = true;
        FOR(i,1,N+1)
            ans &= (cnt[i] == 0);
        if (ans)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
//#include <stdio.h>
using namespace std;

int main(){
	int n,x;
	int count;
	while(1){
		count = 0;
		cin >> n >> x;
		if ( n == 0 && x == 0 ) break;
		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) count++;
				}
			}
		}		
	cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
 
// ------------------------------------------------------------------------------------------------
 
ll n, x;
 
void func() {
    cin >> n >> x;
    ll i = 0;
    for (ll l, c = 0; i < n; i++) {
        cin >> l; c += l;
        if (c > x) {
            break;
        }
    }
    cout << ++i << endl;
}
 
int main() {
    fast_io; cout_precision;
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}

Measured memory_bytes: 256
def q_B(N, K, arrH):
	count = 0
	for i in range(N):
		if arrH[i] >= K:
			count += 1
	print(count)

N, K = map(int, input().split())
arrH = [int(x) for x in input().split()]
q_B(N, K, arrH)


Measured memory_bytes: 11912
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		for (int i=0;i*100<=X;i++) {
			for (int i1=0;i1*101<=X;i1++) {
				for (int i2=0;i2*102<=X;i2++) {
					for (int i3=0;i3*103<=X;i3++) {
						for (int i4=0;i4*104<=X;i4++) {
							for (int i5=0;i5*105<=X;i5++) {
								if (i*100+i1*101+i2*102+i3*103+i4*104+i5*105==X) {
									System.out.println(1);
									return;
								}
							}
						}
					}
				}
			}
		}
		System.out.println(0);
		return;
	}
}

Measured memory_bytes: 35680
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = (1e-10);    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}


int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    P a1 = P(x1, y1);
    P a2 = P(x2, y2);
    P a3 = P(x3, y3);
    P a4 = P(x4, y4);
    
    if (EQ(cross(a1-a2, a3-a4), 0)) {
      std::cout << "YES" << std::endl;
    }else {
      std::cout << "NO" << std::endl;
    }
  }

  
  return 0;
}

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

typedef long long ll;

const int MAXN = 2e5 + 5;

int N;
int a[MAXN], b[MAXN];

struct cmp {
	bool operator()(const int &lhs, const int &rhs) const {
		if (b[lhs] != b[rhs])
			return b[lhs] > b[rhs];
		return lhs < rhs;
	}
};

set <int, cmp> alive;

void load() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
		scanf("%d", a + i);
	for (int i = 0; i < N; i++)
		scanf("%d", b + i);
}

ll solve() {
	for (int i = 0; i < N; i++) {
		if (a[i] > b[i])
			return -1;
		if (a[i] < b[i])
			alive.insert(i);
	}
	
	ll sol = 0;
	while (!alive.empty()) {
		int x = *alive.begin();
		alive.erase(x);
		int sum = b[(x + N - 1) % N] + b[(x + 1) % N];
		if (b[x] <= sum)
			return -1;
		int rem = b[x] % sum;
		if (a[x] >= rem) {
			if ((b[x] - a[x]) % sum)
				return -1;
			sol += (b[x] - a[x]) / sum;
			b[x] = a[x];
		}
		else {
			sol += b[x] / sum;
			b[x] = rem;
			alive.insert(x);
		}
	}
	
	return sol;
}

int main() {
	load();
	printf("%lld\n", solve());
	return 0;
}

Measured memory_bytes: 11136
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	D := readInt()
	G := readInt()
	p := make([]int, D+1)
	c := make([]int, D+1)

	for i := 1; i <= D; i++ {
		p[i] = readInt()
		c[i] = readInt()
	}

	ans := math.MaxInt32
	for i := 0; i < int(math.Pow(2, float64(D))); i++ {
		var sum, nr int
		remaining := make([]int, 0)
		for j := 1; j <= D; j++ {
			if (i>>uint(j-1))&1 == 1 {
				sum += j*100*p[j] + c[j]
				nr += p[j]
			} else {
				remaining = append(remaining, j)
			}
		}
		if sum >= G {
			ans = minInt(ans, nr)
			continue
		}
		for _, j := range remaining {
			score := j * 100
			d := G - sum
			n := d / score
			if d%score != 0 {
				n++
			}
			if n <= p[j] {
				ans = minInt(ans, nr+n)
			}
		}
	}
	println(ans)
}


Measured memory_bytes: 768
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


using i64 = ::std::int_fast64_t;
using u64 = ::std::uint_fast64_t;
using i32 = ::std::int_fast32_t;
using u32 = ::std::uint_fast32_t;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  std::string S;
  std::cin >> S;
  i64 answer = 0;
  i64 possible_answer = 0;
  for (const char& S_i : S) {
    switch (S_i) {
    case 'R':
      ++possible_answer;
      break;
    case 'S':
      answer = std::max(answer, possible_answer);
      possible_answer = 0;
      break;
    }
  }
  answer = std::max(answer, possible_answer);
  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 3608
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    int a,b;
    cin>>a>>b;
    vector<int> vec(a);
    if(a%b==0){
        cout<<a/b<<endl;
    }
    else{
        cout<<a/b+1<<endl;
    }
    
}



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

int main(){

char c;
bool o=false,f=false;

while(scanf("%c",&c),c!='\n'){
if(c=='C')f=true;
else if(f && c=='F')o=true;
}

if(f&&o)cout << "Yes"<<endl;
else cout<<"No"<<endl;

return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
using namespace std;
using ll = long long;


int main(){
   int n;
   cin >> n;
   for(int i = 0; i <= 9; i++){
      int m = i*111;
      int M = (i+1)*111;
      if(m < n && M >= n){
         cout << M << endl;
         return 0;
      }
   }
}

Measured memory_bytes: 256