akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

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

	int a, b;
	cin >> a >> b;
	for (int pr = 1; pr < 1e5; pr++) {
		if ((pr * 8) / 100 == a && (pr * 10) / 100 == b) {
			cout << pr << endl;
			exit(0);
		}
	}
	cout << -1 << endl;
}


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

int main()
{
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	long long a1=max(a*c,a*d);
	long long a2=max(b*c,b*d);
	cout<<max(a1,a2);
	return 0;
}

Measured memory_bytes: 3632
def find(x):#xの親を見つける
  if par[x] < 0:
    return x
  else:
    par[x] = find(par[x])
    return par[x]

def unite(x,y):#要素xとｙを併合させる
  x,y=find(x),find(y)#xとyの親の検索
  if x!=y:#親が異なる場合併合させる
    if x>y:
        x,y=y,x#小さい方をxとする. これにより要素の値が小さいものを優先して木の根とする. 
    par[x]+=par[y] #値を無向木の要素数の和にする.
    par[y]=x #枝側は根の位置を格納

def same(x, y):#要素xと要素yが同じ無向木に所属しているかを判定する
  return find(x) == find(y)#同じ値を持つか否か

def size(x):#要素xが所属する無向木の大きさを返す
  return-par[find(x)]

par = [-1] * 200005#parは木の根の情報を持つ配列, xが根元ならpar[x]はその無向木に所属する要素の数を, そうでない場合は所属する根元のparにおける位置を示す数値が格納される. 


def main():
  n, m = map(int, input().split())
  for i in range(m):
    a, b = map(int, input().split())
    unite(a-1, b-1)
  print(abs(min(par)))
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 16620
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debg cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll ans,n,b,r;
void solve()
{
    cin>>n>>b>>r;
    ans=(n/(b+r))*b;
    ans+=min(n%(b+r),b);
    cout<<ans<<endl;
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#define inf 1<<29
using namespace std;
int n;
long long a[100];
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	a[0]=2;a[1]=1;
	for(int i=2;i<=n;i++){
		a[i]=a[i-1]+a[i-2];
	}
	cout<<a[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int N;
    string s;
    scan(N, s);

    vector<int> e(N), w(N);
    REP(i, N) {
        if (s[i] == 'W')
            w[i]++;
    }
    partial_sum(ALL(w), w.begin());
    RREP(i, N) {
        if (s[i] == 'E')
            e[i]++;
        if (i + 1 < N)
            e[i] += e[i + 1];
    }
    int ans = min(e[1], w[N - 2]);
    FOR(i, 1, N - 1) { chmin(ans, w[i - 1] + e[i + 1]); }
    print(ans);

    return 0;
}

Measured memory_bytes: 2964
#include <iostream>
#include <algorithm>

typedef long long ll;

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

  int K;  std::cin >> K;
  ll ans = 0;
  for (int a = 1; a <= K; ++a)
    for (int b = 1; b <= K; ++b)
      for (int c = 1; c <= K; ++c)
        ans += std::__gcd(a, std::__gcd(b, c));
  std::cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define PUTS(x) cout << (x) << endl;
#define SZ(x) ((int)(x).size())

std::vector<int> find_all(const std::string str, const std::string subStr) {
    std::vector<int> result;

    int subStrSize = subStr.size();
    int pos = str.find(subStr);

    while (pos != std::string::npos) {
        result.push_back(pos);
        pos = str.find(subStr, pos + subStrSize);
    }

    return result;
}

int main() {
    int n;
    string s;
    cin >> n >> s;
    auto v = find_all(s, "ABC");
    PUTS(SZ(v));
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int N=100;

int main()
{
   int n,p[N+1],m[N+1][N+1];  //??´?????????????¬¬i??????????????????p[i-1]*p[i]??????m[i][j]???????????????i??°j??????????????????????§£
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>p[i]>>p[i+1];

    //init
    for(int i=1;i<=n;i++) m[i][i]=0;
    for(int l=2;l<=n;l++) //?????????2????????????????§???????????????´????????°?????????n
    {
        for(int i=1;i<=n-l+1;i++) //?????\??????????????????????¬¬??????????±?????§???????
        {
            int j=i+l-1; //??????
            m[i][j]=1<<21; //?????????????????§???
            for(int k=i;k<j;k++)
            {
                m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);  //????¬????????°????
            }
        }
    }
    cout<<m[1][n]<<endl;
}

Measured memory_bytes: 3136
N = int(input())
A = list(map(int,input().split()))

li,ri = 0,0
ans = 0
xor = A[li]
add = A[li]
while ri < N and li <= ri:
    if xor == add:
        ans += ri - li +1
        ri += 1
        if ri < N:
            xor ^= A[ri]
            add += A[ri]
    else:
        if li < N:
            xor ^= A[li]
            add -= A[li]
        li += 1

print(ans)

Measured memory_bytes: 77772
import sys
from collections import Counter
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

n=int(input())
s_lis=[''.join(sorted(input().rstrip())) for _ in range(n)]

counter = Counter(s_lis) # 同一文字列の出現回数リスト取得
 
answer = sum(x*(x-1)//2 for x in counter.values())
print(answer)

Measured memory_bytes: 19764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s="ACL";
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cout<<s;
    }
    cout<<endl;
}


Measured memory_bytes: 3564
def multi_input():
    return map(int, input().split())

N, K = multi_input()
A = list(map(int, input().split()))

d = [N-A[-1]+A[0]]
for i in range(1, K):
    d.append(A[i]-A[i-1])
    
s = sum(d)
mn = s
for i in range(K):
    mn = min(mn, s-d[i])
print(mn)

Measured memory_bytes: 26444
n, a, b = map(int, input().split())
x = list( map(int, input().split()))

ans = 0

for i in range(len(x)-1):
    toho = (x[i+1] - x[i])*a
    if toho <= b:
        ans += toho
    else:
        ans += b

print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(auto i=0;i<n;i++)
#define s(c) static_cast<int>((c).size())

inline int f(char c){
	switch(c){
	case 'A':
		return 1;
	case 'C':
		return 2;
	case 'G':
		return 3;
	default:
		return 4;
	}
}

int f(string s){
	int rtn = 0, n = s(s)-1;
	r(i, n){
		rtn = 5*(rtn + f(s[i]));
	}
	return rtn + s[n];
}

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

	set<int> dic;
	string cmd, arg;
	int farg;
	r(i, n){
		cin >> cmd >> arg;
		farg = f(arg);
		if(cmd[0] == 'i'){
			dic.insert(farg);
		}else{
			printf(dic.count(farg) ? "yes\n" : "no\n");
		}
	}

	return 0;
}


Measured memory_bytes: 16136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n, m;
  cin >> n >> m;
  cout << (1900 * m + 100 * (n - m)) * pow(2, m) << endl;

  return 0;
}


Measured memory_bytes: 256
X = int(input())

if 400 <= X < 600:
    print('8')
elif 600 <= X < 800:
    print('7')
elif 800 <= X < 1000:
    print('6')
elif 1000 <= X < 1200:
    print('5')
elif 1200 <= X < 1400:
    print('4')
elif 1400 <= X < 1600:
    print('3')
elif 1600<= X < 1800:
    print('2')
else:
    print('1')


Measured memory_bytes: 9176
import java.io.*;
import java.util.Arrays;

public class Main {
    private static int[] pos = new int[5];
    private static int k;

    private static int solver() {
        int idx=0;
        int min=10;

        for(int i=0; i<5;i++){
            int rem = pos[i] % 10;
            if(rem != 0  && rem < min){
                min = rem;
                idx = i;
            }
        }

        int sum=0;
        for(int i=0; i<5;i++){
            if(i==idx){
                sum+=pos[i];
            }else{
                sum+=((pos[i] + 9) / 10)*10;
            }
        }

        return sum;

    }


    public static void main(String[] args) {

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

        try {
            for(int i=0; i<5; i++) {
                String[] inputArray = br.readLine().split(" ");
                pos[i] = Integer.parseInt(inputArray[0]);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println(solver());

    }
}

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

using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define zeroes(x) memset(x,0,sizeof(x))
typedef long long int ll;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn=100000;



long long fe[32];
long long k; 
void decToBinary(long long n) 
{ 
    
    memset(fe,-1,sizeof(fe));
    long long i = 0; 
    while (n > 0) { 
  
        fe[i] = n % 2; 
        n = n / 2; 
        i++; 
    } 
} 

/*int main()
{
    long long n,q,m,b1,ans=0,a1,s,cntn=0,cntp=0,cntz=0,max1=-1,max2=-1;
    cin>>n;
    vector< pair <int,int> >a;
    long long p[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>p[i];
    }
}*/

int main()
{
    long long a,b,c,k,y;
    cin>>a>>b>>c;  
    k=c-(a-b);
    y=0;
    k=max(k,y);
    cout<<k;     
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string N; cin >> N;
    int D = SZ(N);

    mat dp(D + 1, vec(2, INF));
    dp[0][0] = 0;
    REP(i, D){
        int n = N[D - 1 - i] - '0';

        Min(dp[i + 1][0], dp[i][0] + n);
        Min(dp[i + 1][1], dp[i][0] + 10 - n);

        Min(dp[i + 1][0], dp[i][1] + n + 1);
        Min(dp[i + 1][1], dp[i][1] + 9 - n);
    }
    int ans = min(dp[D][0], dp[D][1] + 1);
    Out(ans);

    return 0;
}


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

int main(){
	long long int n, k;
	cin>>n>>k;
	vector<long long int> v(n);
	long long int mn = 0, mx = 1e9;
	for (int i = 0; i<n; i++){
		cin>>v[i];
	}
	long long int M, cnt;
	while(mn+1<mx){
		cnt = 0;
		M = (mn+mx)/2;
		for(auto u : v)
			cnt+=((u+M-1)/M-1);
		if(cnt<=k) mx = M;
		else mn = M;
	}
	cout<<mx;
}


Measured memory_bytes: 4748
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/STACK: 20000000005")
*/

using namespace std;

const ll N = 200005, MOD = 1e9 + 7;



main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    int x;
    string s;
    cin >> x >> s;
    if (x < 3200)
        s = "red";
    cout << s << endl;
    return 0;
}


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


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	long long n;
	cin >> n;
	long long ans = n;
	for(long long i = 2; i * i <= n; i++) {
		if(n % i == 0) {
			ans = ans / i * (i - 1);
			while(n % i == 0) {
				n /= i;
			}
		}
	}
	if(n != 1) ans = ans / n * (n - 1);
	cout << ans << endl;
	return 0;	
}



Measured memory_bytes: 3140
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long[] D = new long[5]; // なぜかintだと正しく実行できない
    for (int i = 0; i < N; i++) {
      String name = sc.next();
      if (name.charAt(0) == 'M') D[0]++;
      if (name.charAt(0) == 'A') D[1]++;
      if (name.charAt(0) == 'R') D[2]++;
      if (name.charAt(0) == 'C') D[3]++;
      if (name.charAt(0) == 'H') D[4]++;
    }
    long res = 0;
    for (int i = 0; i < 5; i++) {
      for (int j = i+1; j < 5; j++) {
        for (int k = j+1; k < 5; k++) {
          res += D[i] * D[j] * D[k];
        }
      }
    }
    System.out.println(res);
  }
}


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

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str;
		String[] arrStr;
		StringBuilder sb = new StringBuilder();
		try {


			while (true) {
				str = br.readLine();
				arrStr = str.split(" ");

				int h = Integer.parseInt(arrStr[0]);
				int w = Integer.parseInt(arrStr[1]);
				if (h == 0 && w == 0) {
					break;
				}
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < w; j++) {
						if (   (i == 0 || j == 0)
							|| ((i == h - 1) || j == w - 1)) {
							sb.append("#");
						}else{
							sb.append(".");
						}
					}
					sb.append("\n");
				}
				System.out.println(sb.toString());
				sb.setLength(0);
			}

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 20676
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		final float N = scan.nextInt();
		scan.close();
		if(N % 2 == 0){
			System.out.println((N / 2) / N);
		}else {
			System.out.println((Math.floor(N / 2) + 1) / N);
		}
	}
}


Measured memory_bytes: 24020
n, x = map(int, input().split())

a = [1]
for i in range(1, n+1):
    a.append(2*a[-1]+3)
p = [1]
for i in range(1, n+1):
    p.append(2*p[-1]+1)

def f(n, x):
    if n == 1:
        if x == 1:
            return 0
        elif 2 <= x and x <= 4:
            return x-1
        else:
            return 3
    if x == 1:
        return 0
    elif 1 < x and x <= 1 + a[n-1]:
        return f(n-1, x-1)
    elif x == 2 + a[n-1]:
        return p[n-1] + 1
    elif 2 + a[n-1] < x and x < a[n]:
        return p[n-1] + 1 + f(n-1, x - (2 + a[n-1]))
    else:
        return p[n]
print(f(n, x))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll x;
	//rl2(x,y);
	cin>>x;
	fr(i,1,10)
	{
		fr(j,1,10){
			if(i*j==x)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
	ll n, m, b, c;
  cin >> n >> m;
  map<ll, ll> a;
  ll input;
  for(int i = 0; i < n; ++i)
  {
    cin >> input;
    a[input]++;
  }
  
  for(int i = 0; i < m; ++i)
  {
    cin >> b >> c;
    int loop_cnt = 0;
    for(auto& val : a)
    {
      if (val.first >= c) break;

      if (val.second > b)
      {
        a[c] += b;
        val.second -= b;
        break;
      }

      loop_cnt++;
      b -= val.second;
      a[c] += val.second;
      val.second = 0;
    }
    a.erase(begin(a), next(begin(a), loop_cnt));

    /*
    for(auto& val : a)
    {
      cout << val.first << " : " << val.second << endl;
    }
    cout << "---\n";
    //*/
  }

  ll ans = 0;
  for(auto& val : a)
  {
    ans += (val.first * val.second);
  }
  cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 9872
#include <cstdio>

int main(void)
{
	int n;
	
	while (scanf("%d", &n)){
		if (n == 0) break;
		int a[7] = {0}, tmp;
		for (int i = 0; i < n; i++){
			scanf("%d", &tmp);
			if (0 <= tmp && tmp < 10) a[0]++;
			else if (10 <= tmp && tmp < 20) a[1]++;
			else if (20 <= tmp && tmp < 30) a[2]++;
			else if (30 <= tmp && tmp < 40) a[3]++;
			else if (40 <= tmp && tmp < 50) a[4]++;
			else if (50 <= tmp && tmp < 60) a[5]++;
			else if (60 <= tmp) a[6]++;
		}
		for (int i = 0; i < 7; i++){
			printf("%d\n", a[i]);
		}
	}
	
	return (0);
}

Measured memory_bytes: 760
n, m = map(int, input().split())
a = set([0] + [int(input()) for _ in range(m)])
MOD = 10 ** 9 + 7

dp = [0] * (n + 1)
dp[0] = 1

if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n + 1):
    if i in a:
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= MOD

print(dp[-1])

Measured memory_bytes: 13700
// AGC025A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int sum(int n) {
	int sum = 0;
	while (n > 0) { // n が 0 になるまで
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main()
{
	int N;
	cin >> N;
	int e[50001] = {};
	e[1] = 2;
	for (int i = 1; i < (N+1)/2; i++)
	{
		int a = sum(i);
		int b = sum(N - i);
		int c = a + b;
		e[i] = c;
	}

	for (int i = 1; i < (N + 1) / 2; i++)
	{
		if (e[1] > e[i]) e[1] = e[i];
	}
	cout << e[1] << endl;
	return 0;

}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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


int main(){
  int a,b,c,d;
  cin >>a;
  cin >>b;
  c = min(a,b);
  d = max(a,b);

  if(c ==1 && d==2)cout<<3<<endl;
  if(c ==1 && d==3)cout<<2<<endl;
  if(c ==2 && d==3)cout<<1<<endl;

}


Measured memory_bytes: 256
use std::io;

fn main(){
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf.retain(|c| c!='\n');
    let arr: Vec::<i32> = buf.split_ascii_whitespace().map(
        |c| c.parse::<i32>().unwrap()		    
    ).collect::<Vec::<i32>>();
    let index = solve(arr.as_ref()).unwrap();
    println!("{}",index);
}

fn solve(arr: &[i32]) -> Option::<i32>{
    let mut tmp = arr.to_owned();
    let mut i = 0;
    for num in tmp{		
	if num == 0 {
	    return Some(i + 1);
	}
	i += 1;
    }
    None
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct UnionFind{
    vector<ll> par;
    vector<ll> siz;

    void init(ll n){
        for(ll i=0;i<n;i++){
            par.push_back(i);
            siz.push_back(1);
        }
    }
    ll root(ll x){
        //根を返す
        if(par[x]==x){
            return x;
        }
        else{
            return (par[x]=root(par[x]));
        }
    }
    bool sameParent(ll x,ll y){
        return(root(x)==root(y));
    }
    void unite(ll x, ll y){
        x=root(x);y=root(y);
        if(x==y)    return;
        //データ構造->小を大にくっつける
        if(siz[x]<siz[y]) swap(x,y);
        siz[x] += siz[y];
        par[y]=x;
    }

    ll size(ll x){
        return siz[root(x)];
    }
};

int main(){
    int n,m;
    cin>>n>>m;
    ll p[n];
    rep(i,n){
        cin>>p[i];
        p[i]--;
    }
    UnionFind uf;
    uf.init(n);
    rep(i,m){
        ll x,y;
        cin>>x>>y;
        x--;y--;
        uf.unite(x,y);
    }
    ll ans=0;
    rep(i,n){
        if(uf.root(p[i])==uf.root(i)) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

// Begin {{{
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)

#ifndef DEBUG
#define dump(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

vector<pii> vec;

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

    int n;
    cin >> n;

    rep(i, n) {
        int a; cin >> a;
        vec.emplace_back(a, 3);
    }

    rep(i, n) {
        int b; cin >> b;
        vec.emplace_back(b, 2);
    }

    rep(i, n) {
        int c; cin >> c;
        vec.emplace_back(c, 1);
    }

    vec.emplace_back(0, 2);
    sort(all(vec));

    vector<i64> cum_a(3 * n + 10), cum_b(3 * n + 10);
    reps(i, 1, vec.size()) {
        cum_a[i] = cum_a[i - 1] + (vec[i].second == 3);
    }

    repr(i, vec.size(), 1) {
        cum_b[i] = cum_b[i + 1] + (vec[i].second == 1);
    }

    i64 ans = 0;
    reps(i, 1, vec.size()) {
        if (vec[i].second == 2) {
            ans += cum_a[i - 1] * cum_b[i + 1];
        }
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 11496
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Aeroui
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char[][] arr = new char[3][];

            for (int i = 0; i < 3; i++) {
                arr[i] = in.next().toCharArray();
            }

            if (arr[0][arr[0].length - 1] == arr[1][0] && arr[1][arr[1].length - 1] == arr[2][0]) {
                out.println("YES");
            } else out.println("NO");

        }

    }
}



Measured memory_bytes: 22868
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

int main(){
  int n;
  cin >> n;
  int ans = INF;
  rep(i, n){
    int a;
    cin >> a;
    int c = 0;
    while (!(a % 2)){
      a /= 2;
      c++;
    }
    ans  = min(ans, c);
  }

  cout << ans << endl;
}



Measured memory_bytes: 256
N, M, C = [ int(x) for x in input().split() ]
Bs = [ int(x) for x in input().split()  ]
As = [ [ int(x) for x in input().split() ] for _ in range(N) ]

ans = 0
for A in As:
    x = C
    for a, b in zip(A, Bs):
        x += a * b
    if x > 0:
        ans += 1

print(ans)


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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

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

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int N, M;
	cin >> N >> M;
	priority_queue<int> C;
	long long int sum = 0;
	for (int i = 0; i < N; i++) {
		int b;
		cin >> b;
		C.push(b);
	}
	for (int i = 0; i < M; i++) {
		int c = C.top();
		C.pop();
		c = c / 2;
		C.push(c);
	}
	for (int i = 0; i < N; i++) {
		int d = C.top();
		sum = sum + d;
		C.pop();
	}
	cout << sum;
}


Measured memory_bytes: 892
#include <stdio.h>
int main(){
  char b=0;
  scanf("%c",&b);
 if(b=='A'){
   printf("T");
 }
  if(b=='T'){
    printf("A");
  }

 if(b=='C'){
   printf("G");
 }
  if(b=='G'){
    printf("C");
  }
  
  return 0;
}

  

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
const int maxn = 2e5;
struct node{
	int next,to;
}e[maxn];
vector<int> edge[maxn]; 
int h[maxn],n,m,a[maxn],point[maxn],b[maxn],fa[maxn],f[maxn],tot;
long long dp[maxn],Sum[maxn];
inline bool cmp(int p,int q){return a[p]<a[q];}
inline void add(int from,int to){e[++tot].to=to,e[tot].next=h[from];h[from]=tot;}
int find(int k){if(f[k]==k)return k;else return f[k]=find(f[k]);} 
void Dfs(int now)
{
	if(edge[now].size()==0)
	{
		Sum[now]=b[now];
		dp[now]=a[now]+b[now];return ;
	}Sum[now]=b[now];
	for(register int i=0;i<edge[now].size();++i)
	{
		int to=edge[now][i];
		Dfs(to);Sum[now]+=Sum[to];
	}
	dp[now]=1e18+8;
	for(register int i=0;i<edge[now].size();++i)
	{
		dp[now]=min(dp[now],max((long long)a[now],dp[edge[now][i]])+Sum[now]-Sum[edge[now][i]]);
	}
} 
int main()
{
	n=read(),m=read();
	for(register int i=1,w1,w2;i<=n;++i) {a[i]=read(),b[i]=read();a[i]=max(0,a[i]-b[i]);point[i]=i;}
	sort(point+1,point+n+1,cmp);
	for(register int i=1,u,v;i<=m;++i) u=read(),v=read(),add(u,v),add(v,u); memset(fa,-1,sizeof(fa));
	for(register int i=1;i<=n;++i)
	{
		int now=point[i];f[now]=now;
		for(register int j=h[now];j;j=e[j].next)
		{
			int to=e[j].to;int Fa=find(to);if(fa[Fa]==0)fa[Fa]=now,f[Fa]=now;
		}
		fa[now]=0;
	}
	int rt;
	for(register int i=1;i<=n;++i){if(fa[i]) edge[fa[i]].pb(i);else rt=i;}
	Dfs(rt);
	cout<<dp[rt];
	return 0;
}


Measured memory_bytes: 20224
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



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

	vector<string> s(N + 1);
	repn(i, N) cin >> s[i];

	ll a = 0;
	ll b = 0;
	ll c = 0;

	ll ans = 0;
	repn(i, N) {
		ll M = s[i].size();
		rep(j, M - 1) { if (s[i][j] == 'A'&&s[i][j+1] == 'B') { ans++; } }

		if (s[i][0] == 'B'&&s[i][M - 1] == 'A') { a++; }
		else if (s[i][0] == 'B') { b++; }
		else if (s[i][M - 1] == 'A') { c++; }
	}

	if (b == 0 && c == 0 && a!=0) { ans += a - 1; }
	else { ans += a + min(b, c); }

	cout << ans;


	system("PAUSE");
}


Measured memory_bytes: 1024
// Aizu Vol-1 0191: Baby Tree
// 2017.8.23 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <math.h>

#define MAX 100
#define EPS 1.0e-5

double d[MAX+3][MAX+3];
double t[2][MAX+3];
char f[MAX+3];

int cmp(double a, double b)
{

	if (fabs(a-b) <= EPS) return 0;
	if (a <= b) return -1;
	return 1;
}

int main()
{
	int n, m;
	int i, j, k, k1, k2;
	double g;

	while (scanf("%d%d", &n, &m) && n) {
		for (i = 0; i < n; i++) for (j = 0; j < n; j++) scanf("%lf", d[i]+j);
		for (i = 0; i < n; i++) t[0][i] = 1.0;
		for (k1 = 0, k2 = 1, k = 2; k <= m; k++, k1 = k2, k2 = !k2) {
			memset(f, 0, sizeof(f));
			for (i = 0; i < n; i++) for (j = 0; j < n; j++) {
				g = t[k1][i]*d[i][j];
				if (!f[j]) t[k2][j] = g, f[j] = 1;
				else if (cmp(t[k2][j], g) < 0) t[k2][j] = g;
			}
		}
		for (g = -1.0, i = 0; i < n; i++)
			if (cmp(t[k1][i], g) > 0) g = t[k1][i];
		printf("%.2lf\n", g);
	}
	return 0;
}

Measured memory_bytes: 744
#include <iostream>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b;
    if (a > b) {
        c = a;
        a = b;
        b = c;
    }
    cin >> c;
    if (a <= c && c <= b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;    
}


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


int main() {
 ll n,w;
 cin>>n>>w;
 ll arr[n][2];
 for(int i=0;i<n;i++)cin>>arr[i][0]>>arr[i][1];
 
 ll dp[n+1][w+1];
 for(int i=0;i<=n;i++){
     for(int j=0;j<=w;j++){
         if(i==0||j==0){dp[i][j]=0;}
         
         else if(j-arr[i-1][0]>=0){
             dp[i][j]=max(dp[i-1][j],arr[i-1][1]+dp[i-1][j-arr[i-1][0]]);
         }
         
         else{
             dp[i][j]=dp[i-1][j];
         }
         
     }
 }
//  for(int i=0;i<=n;i++){
//      for(int j=0;j<=w;j++){cout<<dp[i][j]<<" ";}cout<<endl;}
 
 
cout<<dp[n][w]<<endl; 
 
 
 
}

Measured memory_bytes: 79104
# 2つの部分列に分ける
def eqcut(start, end):
    target = (cumA[start - 1] + cumA[end]) / 2  # start = 0のときcumA[-1] = 0

    ok = start
    ng = end + 1
    while ng - ok > 1:
        mid = (ok + ng) // 2
        if cumA[mid] <= target:
            ok = mid
        else:
            ng = mid
    # okかok+1
    if ok == end:
        return ok
    else:
        diff1 = abs( (cumA[end] - cumA[ok]) - (cumA[ok] - cumA[start - 1]))
        diff2 = abs( (cumA[end] - cumA[ok + 1]) - (cumA[ok + 1] - cumA[start - 1]))
        if diff1 <= diff2:
            return ok
        else:
            return ok + 1
            

N = int(input())
A = [int(x) for x in input().split()]

cumA = [A[0]] + [0] * N  # 累積和  cumA[-1] = 0となるように最後にダミー
for i in range(1, N):
    cumA[i] = cumA[i - 1] + A[i]

S = [0, 0, 0, 0]
B = [0, 0]
ans = cumA[N - 1]
# 3本の境界線のうち中央を探す
for i in range(1, N - 2):
    B[0] = eqcut(0, i)  # A[0], ..., A[i]を要素の総和が最小となる2つの部分列に分ける
    S[0] = cumA[B[0]]
    S[1] = cumA[i] - cumA[B[0]]

    B[1] = eqcut(i + 1, N - 1)
    S[2] = cumA[B[1]] - cumA[i]
    S[3] = cumA[N - 1] - cumA[B[1]]

    ans = min(ans, max(S) - min(S))

print(ans)

Measured memory_bytes: 89208
#include<iostream>
#include<string>
using namespace std;
int main(){
   string s;
   cin>>s;
   string ss;
    ss+=s[0];
    ss+=s[1];
    ss+=s[2];
   // cout<<ss<<" "<<"\n";
    int res=abs(753-stoi(ss));
   for(int i=3;i<s.length();i++)
    {   ss="";
      	ss+=s[i-2];
    ss+=s[i-1];
    ss+=s[i];
       res=min(res,abs(753-stoi(ss)));
    	
	}
	cout<<res;
  
  
}


Measured memory_bytes: 256
s = input()

count = 0
m = 0

for i in range(len(s)):
  if s[i] is 'A' or s[i] is "G" or s[i] is "C" or s[i] is "T":
    count += 1
  else:
    m = max(count,m)
    count = 0
m = max(count,m)
print(m)


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

int findSumOfDigits(int n){
  int sum = 0;
  while(n > 0){
    sum += n%10;
    n/=10;
  }
  return sum;
}


int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int total = 0;
  for(int i = 1; i <= N; ++i){
    int sum = findSumOfDigits(i);
  if(sum >= A && sum <= B){
    total += i;
  }
  }
  cout << total << endl;
}

Measured memory_bytes: 3588
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int max=0;
		int min=0;
		if(N >= 1 && N<=100) {
//		nがa+b以下
			if(A+B<=N) {
				if(A>B) {
					max = B;
					min = 0;
				}else if (A<=B) {
					max = A;
					min = 0;
				}
			}
//
			if(A+B>N) {
				if(A>=B) {
					max = B;
					min = (A+B)-N;
				}else if(A<B) {
					max = A;
					min = (A+B)-N;
				}
			}
			if(A==B && A==N) {
				max = N;
				min = N;
			}
		}
		System.out.println(max +" "+ min);




	}
}


Measured memory_bytes: 22484
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long LL;
#define M(a,b) memset(a,b,sizeof(a))
#define pb push_back
const int maxn = 100000+5;
const LL mod = 1000000007;
char s[50];
int main() {

    scanf("%s",s);
    for (int i=0;s[i];++i) {
        if (s[i]==',') {
            s[i]=' ';
        }
    }
    puts(s);
    return 0;
}

Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/05/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  vector<int> A; for (int i = 0; i < n; i++) {
    int a; cin>>a;
    A.push_back(a);
  }

  vector<vector<ll>> dp(n, vector<ll>(n));
  for (int i = 0; i < n; i++) {
    dp[i][i] = A[i]*(n%2==0?-1:1);
  }
  for (int d = 2; d <= n; d++) {
    for (int l = 0; l <= n-d; l++) {
      auto r = l+d-1;
      auto t = n-d;
      if (t%2==1) {
        dp[l][r] = min(dp[l][r-1]-A[r], dp[l+1][r]-A[l]);
      } else {
        dp[l][r] = max(dp[l][r-1]+A[r], dp[l+1][r]+A[l]);
      }
    }
  }
  cout << dp[0][n-1] << endl;

  return 0;
}


Measured memory_bytes: 70784
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
vpint adj[10000];
int d[10000],color[10000],p[10000];
void dijkstra(int N,int st){
	priority_queue<pint> PQ;//辺の長さのオーバーフローに注意！
	rep(i,N){
		d[i]=INF;
		color[i]=0;
	}
	d[st]=0;
	color[st]=1;
	PQ.push(mp(0,st));
	while(!PQ.empty()){
		pint f=PQ.top();
		PQ.pop();
		int u=f.second;
		color[u]=2;
		if(d[u]< -f.first) continue;
		rep(j,adj[u].size()){
			int v=adj[u][j].first;
			if(color[v]==2) continue;
			if(d[v]>d[u]+adj[u][j].second){
				d[v]=d[u]+adj[u][j].second;
				PQ.push(mp(-d[v],v));
				color[v]=1;
			}
		}
	}
}
int main(){
	int N,X,Y;
	scan(N>>X>>Y);
	X--; Y--;
	rep(i,N-1){
		adj[i].push_back({i+1,1});
		adj[i+1].push_back({i,1});
	}
	adj[X].push_back({Y,1});
	adj[Y].push_back({X,1});
	int cnt[N]={};
	rep(i,N){
		dijkstra(N,i);
		rep(j,N){
			cnt[d[j]]++;
		}
	}
	rep1(k,N-1){
		prin(cnt[k]/2);
	}
	return 0;
}


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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            var cin = GetIntArray();
            var ans = Math.Min(cin[0] * cin[1], cin[2]);

            Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }

        static long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13396
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiConsumer;

public class Main {

    //グローバル変数を定義
    int a;
    int b;
    int c;
    long finalCount = Long.MAX_VALUE;

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

    void run() {
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        int m = Math.max(Math.max(a, b), c);

        if(3*m % 2 == (a+b+c) % 2){
            System.out.println((3*m-(a+b+c))/2 + (3*m-(a+b+c))%2);
        } else {
            System.out.println((3*(m+1)-(a+b+c))/2 + (3*(m+1)-(a+b+c))%2);
        }
    }
}


Measured memory_bytes: 21716