akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"
import "os"
import "math"

func main() {
	var n int

	fmt.Fscanf(os.Stdin, "%d", &n)

	vacs := make([][3]int, n)

	for i:=0; i<n; i++ {
		fmt.Fscanf(os.Stdin, "%d", &vacs[i][0])
		fmt.Fscanf(os.Stdin, "%d", &vacs[i][1])
		fmt.Fscanf(os.Stdin, "%d", &vacs[i][2])
	}

	fmt.Println(maxPoints(vacs))
}

func maxPoints(vacs [][3]int) int {
	n := len(vacs)
	
	dp := make([][3]int, n)

	dp[0][0] = vacs[0][0]
	dp[0][1] = vacs[0][1]
	dp[0][2] = vacs[0][2]

	for i:= 1; i<n; i++ {
		dp[i][0] = max(dp[i-1][1] + vacs[i][0], dp[i-1][2] + vacs[i][0])
		dp[i][1] = max(dp[i-1][0] + vacs[i][1], dp[i-1][2] + vacs[i][1])
		dp[i][2] = max(dp[i-1][1] + vacs[i][2], dp[i-1][0] + vacs[i][2])
	}

	return max(dp[n-1][0], dp[n-1][1], dp[n-1][2])
}

func max(nums ...int) int {
	m := math.MinInt64
	for _, v := range nums {
		if v > m {
			m = v
		}
	}
	return m
}


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

typedef long long ll;
typedef long double ld;

ll sum[105];
ll dod[105];
int mat[1005][1005];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

	int h, w, k;
	cin >> h >> w >> k;
	for(int i=0; i<h; i++){
        string s;
        cin >> s;
        for(int j=0; j<w; j++){
            mat[i][j] = s[j]-'0';
        }
	}
	ll res = h+w;
	for(int mask=0; mask<(1<<(h-1)); mask++){
        ll tren = __builtin_popcount(mask);
        for(int i=0; i<h; i++) sum[i] = 0;
        for(int i=0; i<w; i++){
            for(int i=0; i<h; i++) dod[i] = 0;
            int tr = 0;
            bool ima = 0, moze = 1;
            for(int j=0; j<h; j++){
                //cout << mat[i][j];
                dod[tr] += mat[j][i];
                sum[tr] += mat[j][i];
                if(dod[tr] > k) moze = 0;
                if(sum[tr] > k) ima = 1;
                if(j < h-1 && ((1<<j)&mask)) tr++;
            }
            //cout << endl;
            //if(mask == 0) cout << dod[0] << endl;
            if(!moze){
                tren = res;
                break;
            }
            if(ima){
                for(int j=0; j<h; j++) sum[j] = dod[j] = 0;
                i--;
                tren++;
                continue;
            }
        }
        //cout << tren << " " << mask << endl;
        res = min(res, tren);
	}
	cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			cout << i << 'x' << j << '=' << i * j << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a>b){
		swap(a,b);
	}
	if(a>c){
		swap(a,c);
	}
	if(b>c){
		swap(b,c);
	}
	cout<<a<<" "<<b<<" "<<c<<endl;;
	return 0;
}

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

int main(){
	int n, f, i;
	char c;
	while(cin >> n, n != 0){
		f = 0;
		int a[n];
		for(i = 0; i < n; i++){
			a[i] = 0;
		}
		for(i = 0; i < 100; i++){
			cin >> c;
			switch(c){
				case 'M':
					a[i % n]++;
					break;
				case 'S':
					f += 	a[i % n]+1;
					a[i%n] = 0;
					break;
				case 'L':
					a[i % n] += f+1;
					f = 0;
					break;
			}
		}
		sort(a, a+n);
		for(i = 0; i < n; i++){
			cout << a[i] << " ";
		}
		cout << f << endl;
	}
	return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define setbit(s, i) (s|=(1LL<<(i)))
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "C"
int n;
int a[3][101];
int main(){
    #ifdef Kanikou
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Kanikou
    read(n);
    FOR(i, 1, 2) FOR(j, 1, n) read(a[i][j]);
    int ans=0;
    FOR(i, 1, n){
        int res=0;
        FOR(j, 1, i) res+=a[1][j];
        FOR(j, i, n) res+=a[2][j];
        ans=max(ans, res);
    }
    write(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
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 pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}


int main() {
    int n;
    cin >> n;
    vector<int> X(n);
    rep(i,n) {
        cin >> X[i];
    }
    int res = INF;
    for(int i=1; i<=100; ++i) {
        int _res = 0;
        rep(j,n) {
            _res += pow((X[j]-i),2);
        }
        res = min(_res,res);
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
import math

A,B,H,M = map(int,input().split())

deg_H = 30 * H + 0.5 * M
deg_M = 6 * M
deg = abs(deg_H - deg_M) if abs(deg_H - deg_M) <= 180 else 360 - abs(deg_H - deg_M)

ans2 = A**2 + B**2 - 2*A*B*math.cos(math.radians(deg))
ans = math.sqrt(ans2)
print(ans)

Measured memory_bytes: 9568
import math
def f(n):
    mx=0
    for i in range(2,1+int(math.sqrt(n))):
        if n%i==0:
            mx=i
    if mx==0:
        mx=1
    return mx

def main():
    N=int(input())
    fact1=f(N)
    return fact1+N//fact1-2

print(main())


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

const long long INF = (1 << 40);

int main(){
  int n;
  cin >> n;
  
  long long w;
  cin >> w;
  
  int weight[110],value[110];
  
  rep(i,n){
    cin >> weight[i] >> value[i];
  }
  
  long long dp[110][100100] = {0}; 
  
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= w; j++){
      //i番目の品物を選ぶ場合
      if(j - weight[i] >= 0){
      	dp[i+1][j] = max(dp[i][j - weight[i]] + value[i], dp[i+1][j]);
      }
      //選ばない場合
      dp[i+1][j] = max(dp[i][j], dp[i+1][j]); 
    }
  }
  
  
  cout << dp[n][w] << endl;
  return 0;
}

Measured memory_bytes: 86272
# include <bits/stdc++.h>
using namespace std;
int main() {
  int s;
  cin >> s;
  int count = 1;
  while(1) {
    if(s==4||s==2||s==1) {
      cout <<count+3<<endl;
      return 0;
    }
    if(s%2==1) {
      s = 3*s+1;
      count++;
    } else {
      s = s/2;
      count++;
    }
  }
}

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

int main()
{
   
   int a,b,c,col;
   cin>>a>>b>>c;
   col=3;
   if(a==b||b==c||c==a){
       col--;
   }
   if(a==b&&b==c){
       col--;
   }
   cout<<col<<endl;
   return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n string
	fmt.Scan(&n)
	for i := 0; i < 2; i++ {
		if n[i] == n[i+1] && n[i] == n[i+2] {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
const int Max = 1e6 + 5;
const int Mod = 1e9 + 7;
int lst[Max];
ll ls[Max];

int main()
{
	int n;
	cin >> n;
	map<int, int> ma;
	int f = 0;
	for (int i = 1;i <= n;i++)
	{
		int t;
		scanf("%d", &t);
		ma[t]++;
		if (ma[t] >= 4) f = 1;
	}
	int g = 0;
	for (auto i = --ma.end();;i--)
	{
		int t = i->second;
		while (t>=2)
		{
			t -= 2;
			g++;
			ls[g] = i->first;
		}
		if (g >= 2) break;
		if (i == ma.begin())break;
	}
	if (g < 2)cout << 0 << endl;
	else cout << ls[1] * ls[2];
}

Measured memory_bytes: 7920
#include <bits/stdc++.h>
#define lol long long
using namespace std;
int main(){
    int a,b;
    string s,t;
    cin>>a>>b;
    if((a+b)%2==0)
        cout<<(a+b)/2<<"\n";
    else cout<<(a+b)/2 + 1<<"\n";
    return(0);
}

Measured memory_bytes: 3560
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

map<ll, int> ans;
int main() {
  ll v = 1;
  REP(i, 30) {
    ans[v] = i;
    v *= 3;
  }
  while (scanf("%lld", &v) > 0) {
    printf("%d\n", ans.lower_bound(v)->second);
  }
}

Measured memory_bytes: 0
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/dp/tasks/dp_h
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;

int N;
double p[2999];

double ans = 0;

//左からi番目まで(i番目含む)を見たときに
//裏がj個出る確率をdp[i][j]とおく
vector<vector<double>> dp;

void solve(){
	dp = vector<vector<double>>(N,vector<double>(N+1,0.0));
	dp[0][0] = p[0];
	dp[0][1] = 1.0-p[0];
	for(int i=0;i<N-1;i++){//i番目までのコインを見たとき
		for(int j=0;j<=i+1;j++){//j個、すでに裏が出ている時を考える
			dp[i+1][j] += dp[i][j]*p[i+1];
			dp[i+1][j+1] += dp[i][j]*(1-p[i+1]);
		}
	}
	for(int j=0;j<=(N/2-(N%2==0));j++){
		ans += dp[N-1][j];
	}
}
 
int main(){
	cin >> N;
	for(int i=0;i<N;i++) cin >> p[i];
 
	solve();

	cout << fixed << setprecision(20)  << ans << endl;
	return 0;
}

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

#define ll long long int

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

ll mod=1000000007;
string k;
ll d;

ll dp[10005][105][3];

ll recur(ll ind,ll rem,ll check){
	if(ind==k.size() && rem==0){return 1;}
	if(ind==k.size())return 0;
	if(dp[ind][rem][check]!=-1)return dp[ind][rem][check];
	
	ll ans=0;
	if(check)
	{
		for(ll i=0;i<=9;i++)
		{
			ans=(ans+recur(ind+1,(rem+i)%d,1))%mod;
		}
	}
	else
	{
		for(ll i=0;i<=k[ind]-'0';i++)
		{
			if(i<k[ind]-'0')
				ans=(ans+recur(ind+1,(rem+i)%d,1))%mod;
			else
				ans=(ans+recur(ind+1,(rem+i)%d,0))%mod;
		}
	}
	dp[ind][rem][check]=ans;
	return ans;
}

int main()
{
	fastio();
	cin>>k>>d;
	memset(dp,-1,sizeof(dp));
	ll ans=recur(0,0,0)-1;
	if(ans<0)ans+=mod;
	cout<<ans;
}


Measured memory_bytes: 25728
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.length();
    ll ans=1,num=1;
    for(int i=0;i<n;i++){
        ans*=3;
        ans%=mod;
        if(s[i]=='1')num++;
        else ans-=modpow(2,num);
        ans%=mod;
    }
    cout << (ans+mod)%mod <<endl;
    return 0;
}


Measured memory_bytes: 512
k,x = map(int,input().split())
l=[]
hidari=x-k+1
migi=x+k
if hidari< -(1000000):
    hidari= -(1000000)
if migi>1000000:
    migi=1000000
for i in range(hidari,migi):
    l.append(i)
lng=len(l)
print(" ".join(map(str,l)))

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
  int a[100001] = {0};
  int n;
  long sum = 0;
  scanf("%d", &n);
  for(int i = 1;i <= n;i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    sum += x;
  }
  int q;
  scanf("%d", &q);
  for(int i = 0;i < q;i++) {
    int b, c, d;
    scanf("%d%d", &b, &c);
    d = c - b;
    sum += d * a[b];
    a[c] += a[b];
    a[b] = 0;
    printf("%ld\n", sum);
  }
}

Measured memory_bytes: 2512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        List<string> strs = new List<string>();

        int answer = 0;
        string tmp = "";
        string before = "";
        for (int i = 0; i < s.Length; i++)
        {
            tmp += s[i].ToString();

            if (before != tmp)
            {
                answer++;
                before = tmp;
                tmp = "";
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 16604
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var p1 = 0; var p2 = 0; var p4 = 0;
        for (int i = 0; i < n; i++)
        {
            var w = int.Parse(line[i]);
            if (w % 4 == 0) p4++;
            else if (w % 2 == 0) p2++;
        }
        p1 = n - p4 - p2;
        Console.WriteLine(check(p1, p2, p4) ? "Yes" : "No");
    }
    public static bool check(int p1, int p2, int p4)
    {
        if (p1 == 0) return true;
        if (p4 == 0) return false;
        if (p2 == 0) return p1 - p4 <= 1;
        else return p1 <= p4;
    }
}

Measured memory_bytes: 18016
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn =2e3+5;
const double pi=acos(-1);

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double jiao1=2.0*pi*m/60.0;
	double shi=h*60.0+m;
	double jiao2=2.0*pi*shi/720.0;
	/*if(jiao1>=pi)
    {
        jiao1=2.0*pi-jiao1;
    }
    if(jiao2>=pi)
    {
        jiao2=2.0*pi-jiao2;
    }*/
    //cout<<jiao1<<" "<<jiao2<<'\n';
    double jiao=abs(jiao1-jiao2);
    double ans=sqrt(a*a+b*b-2.0*a*b*cos(jiao));
    //double ans=sqrt(a*a+b*b-2.0*a*b*cos(jiao));
    cout<<fixed<<setprecision(15)<<ans<<'\n';



}


Measured memory_bytes: 4256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
using namespace std;

#define rep(i,N) for(int i=0; i<N; i++)
#define revrep(i,N) for(int i=N-1; i>=0; i--)

typedef long long ll;

int main(void)
{
    int A,B,Q;
    cin >> A >> B >> Q;

    vector<ll> s(A);
    vector<ll> t(B);
    vector<ll> x(Q);

    rep(i,A) {cin >> s[i];}
    rep(i,B) {cin >> t[i];}
    rep(i,Q) {cin >> x[i];}

    rep(i,Q) {

        auto itrS1 = std::lower_bound(s.begin(), s.end(), x[i]);
        auto itrS2 = itrS1-1;
        ll s1 = (itrS1 == s.end() ?    100000000000 : *(itrS1));
        ll s2 = (itrS1 == s.begin() ? -100000000000 : *(itrS1-1));

        auto itrT1 = std::lower_bound(t.begin(), t.end(), x[i]);
        auto itrT2 = itrT1-1;
        ll t1 = (itrT1 == t.end() ?    100000000000 : *(itrT1));
        ll t2 = (itrT1 == t.begin() ? -100000000000 : *(itrT1-1));


        ll ret = min({
          max(abs(s1-x[i]), abs(t1-x[i])),
          max(abs(s2-x[i]), abs(t2-x[i])),
          abs(s1-x[i])*2 + abs(t2-x[i]),
          abs(s2-x[i])*2 + abs(t1-x[i]),
          abs(s1-x[i]) + abs(t2-x[i])*2,
          abs(s2-x[i]) + abs(t1-x[i])*2, 
        });
        cout << ret << endl;
    }

}


Measured memory_bytes: 3712
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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 = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}



int main() {
    int N;cin >> N;
    map<int,long long> fac;
    for(int i = 2;i<=N;i++){
        int A = i;
        while(A > 1){
            int prv = A;
            for(int j = 2;j<=(int)sqrt(A);j++){
                if(A % j == 0){
                    fac[j]++;
                    A /= j;
                    break;
                }
            }
            if(prv == A){
                fac[A]++;
                break;
            }
        }
    }
    long long ans = 1;
    for(auto V : fac){
        int div = V.second;
        ans *= div+1;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int ans=700;
  char S[5];
  scanf("%s",S);
  if(S[0]=='o'){
    ans=ans+100;
  }
  if(S[1]=='o'){
    ans=ans+100;
  }
  if(S[2]=='o'){
    ans=ans+100;
  }
  printf("%d\n",ans);
  return 0;
}

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

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};


ll mypow(ll a, ll b, ll mod) {
    ll ret = 1;
    while (b) {
        if (b & 1) ret = (ret * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ret;
}

int main() {
    int m, n;
    cin >> m >> n;
    prt(mypow(m, n, MOD));

    return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
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;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

signed main() {
    INIT;
    char c;
    cin >> c;
    S = "aiueo";
    REP(i, 5)
    if (c == S[i]) {
        cout << "vowel" << endl;
        return 0;
    }
    cout << "consonant" << endl;
}

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

int main(){
  int n,m,i,j;
  cin>>n;
  string s[n];
  for(i=0;i<n;i++){
    cin>>s[i];
  }
  cin>>m;
  string t[m];
  for(i=0;i<m;i++){
    cin>>t[i];
  }
  string p[n+1];
  int cnt=0;
  for(i=0;i<n;i++){
    for(j=0;j<cnt;j++){
      if(s[i]==p[j]){
		  break;
	  }
    }
	if(s[i]!=p[j]){
		p[cnt]=s[i];
		cnt++;
	}
  }
  int score[cnt];
  for(i=0;i<cnt;i++){
    score[i]=0;
    for(j=0;j<n;j++){
      if(p[i]==s[j])score[i]++;
    }
    for(j=0;j<m;j++){
      if(p[i]==t[j])score[i]--;
    }
  }
  int ma=0;
  for(i=0;i<cnt;i++){
    ma=max(ma,score[i]);
  }
  cout<<ma;
}

Measured memory_bytes: 256
from functools import reduce
N = int(input())
s_list = [input() for i in range(N)]

s_list = [ sorted(s) for s in s_list]
s_list = [ reduce(lambda x, y: x+y, s) for s in s_list]

s_map = {}
for s in s_list:
    if s in s_map:
        s_map[s] += 1
    else:
        s_map[s] = 1

ans = 0
for k, v in s_map.items():
    if v > 1:
        ans += v*(v-1)/2
print(int(ans))

Measured memory_bytes: 31772
#include <bits/stdc++.h>
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
int main() {
  int ans=0;
	string s,t;
  cin >> s >> t;
  for(int i=0;i<3;i++){
  	if(s.at(i)==t.at(i)) ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

/*
ll comb(ll n, ll r){
        ll i=1;
        ll k=r>n-r?n-r:r, count;
        if(k<0)return 0;
        for(count=1;count<=k;count++){
                i*=n-count+1;
                i/=count;
        }
        return i;
}
*/

int main(){
        ll N;
        ll tmp;
        cin>>N;
        vector <int> a(N);
        ll max=0;
        ll ans1=0, ans2=0;
        for(ll i=0;i<N;i++){
                cin>>a[i];
        }
        sort(a.begin(), a.end());
        ll minabs=a[N-1];
        for(ll i=0;i<N-1;i++){
                tmp=abs((a[N-1]/2)-a[i]);//半分との差
                if(tmp<=minabs){
                        minabs=tmp;
                        ans1=a[N-1];
                        ans2=a[i];
                }
        }
        cout<<ans1<<" "<<ans2<<endl;
        return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<math.h>
#include<stdio.h>

using namespace std;
int main() {
  double r, s, p;
  cin >> r;
  s = r * r * M_PI;
  p = (r * 2) * M_PI;
  printf("%.6f %.6f\n", s, p);
  return 0;
}

Measured memory_bytes: 1240
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

vector<vector<int>> nodes(100000, vector<int>());

bool findPath(int target, int node, vector<int> &path, int from) {
  if (node == target) {
    path.push_back(node);
    return true;
  }
  rep(i, nodes[node].size()) {
    if (nodes[node][i] == from) continue;
    if (findPath(target, nodes[node][i], path, node)) {
      path.push_back(node);
      return true;
    }
  }
  return false;
}

int maxDistance(int from, int node) {
  vector<int> dist;
  rep(i, nodes[node].size()) {
    if (nodes[node][i] != from) {
      dist.push_back(maxDistance(node, nodes[node][i]));
    }
  }
  if (dist.size() == 0) {
    return 0;
  }
  int maxDist = 0;
  rep(i, dist.size()) {
    maxDist = max(maxDist, dist[i]);
  }
  return maxDist + 1;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  int N, u, v, a, b;
  cin >> N >> u >> v;
  u--;
  v--;
  rep(i, N - 1) {
    cin >> a >> b;
    a--;
    b--;
    nodes[a].push_back(b);
    nodes[b].push_back(a);
  }

  vector<int> utov;
  findPath(u, v, utov, -1);

  int dist = utov.size() - 1;
  if (dist % 2 == 0) {
    out(maxDistance(utov[dist / 2], utov[dist / 2 - 1]) + dist / 2);
  } else {
    out(maxDistance(utov[dist / 2 + 1], utov[dist / 2]) + dist / 2);
  }
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long a,b;
  cin>>a>>b;
  if(b==1) cout<<a*(a-1)/2<<endl;
  else cout<<(a-b+3)*(a-b)/2+b-2<<endl;
  
  return 0;
}



Measured memory_bytes: 3224
#include<cstdio>
using namespace std;
int main(void)
{
	int n,k[10000];
	int i,j,cnt,flg;
	
	while(1)	{
		scanf("%d",&n);
		if(n==0)	break;
		flg=0;
		cnt=0;
		for(i=0;i<n;i++)	{
			scanf("%d",&k[i]);
			if(k[i]>1)	flg=1;
			if(k[i]!=0)	cnt++;
		}
		if(flg==0)	{
			printf("NA\n");
		}
		else {
			printf("%d\n",cnt+1);
		}
	}
	return 0;
}


Measured memory_bytes: 1080
#include <stdio.h>
#include <math.h>

double Sum(double data[], int num);
void InitArray(double* data, int num);

#define nMAX 1000

int main(void)
{
	int n;			//入力されるデータの数
	double s[nMAX];	//データを入れる配列
	double a;		//標準偏差
	int i;

	//配列を初期化する
	InitArray(s, nMAX);

	while (1)
	{
		//データの数を入力する
		scanf("%d", &n);

		//0が入力されたら処理を終了する
		if (n == 0)
		{
			break;
		}

		//データを入力する
		for (i = 0; i < n; i++)
		{
			scanf("%lf", &s[i]);
		}

		//標準偏差を求める
		a = fabs(sqrt(Sum(s, n) / n));

		//結果を出力する
		printf("%lf\n", a);

		//配列を初期化する
		InitArray(s, nMAX);
	}

	return 0;
}

//標準偏差の一部を計算する
double Sum(double data[], int num)
{
	int i;
	double sum = 0;	//合計
	double ave;		//平均

	//データの合計を求める
	for (i = 0; i < num; i++)
	{
		sum += data[i];
	}

	//平均を求める
	ave = sum / num;

	//各データの値と平均の差の2乗の合計を求める
	sum = 0;
	for (i = 0; i < num; i++)
	{
		sum += pow(data[i] - ave, 2);
	}

	//結果を返す
	return sum;
}

//配列を初期化する
void InitArray(double* data, int num)
{
	int i;
	for (i = 0; i < num; i++)
	{
		data[i] = 0;
	}
}


Measured memory_bytes: 2148
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
int H,W;
char mp[1010][1010];
int d[1010][1010];
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};

void dijkstra(){
    priority_queue<P, vector<P>, greater<P>> pque;
    for(int i = 0; i < 1010; i++){
        for(int j = 0; j < 1010; j++){
            if(mp[i][j] == '#'){
                d[i][j] = 0;
                pque.push({0, {i, j}});
            }else{
                d[i][j] = INF;
            }
        }
    }
    
    while(!pque.empty()){
        int c = pque.top().first;
        int y = pque.top().second.first;
        int x = pque.top().second.second;
        pque.pop();
        if(d[y][x] < c){
            continue;
        }
        
        for(int i = 0; i < 4; i++){
            int ny = y + dy[i];
            int nx = x + dx[i];
            if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
            if(mp[ny][nx] == '#') continue;
            if(d[ny][nx] > c + 1){
                d[ny][nx] = c + 1;
                pque.push({d[ny][nx], {ny, nx}});
            }
        }
    }
    
    int m = -1;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            m = max(m, d[i][j]);
        }
    }
    cout << m << endl;
    
}



int main(void){
    cin >> H >> W;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> mp[i][j];
        }
    }
    dijkstra();
}


Measured memory_bytes: 19692
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
Scanner sc1=new Scanner(System.in);
int temp=0;
long suma;
byte N=sc1.nextByte();
byte M=sc1.nextByte();
byte C=sc1.nextByte();
byte arr[]=new byte[M];
for(byte i=0;i<M;i++){arr[i]=sc1.nextByte();}
byte matriz[][]=new byte[N][M];
for(byte i=0;i<N;i++){
for(byte j=0;j<M;j++){matriz[i][j]=sc1.nextByte();}
}
for(byte i=0;i<N;i++){suma=C;
for(byte j=0;j<M;j++){suma+=(matriz[i][j]*arr[j]);}
if(suma>0){temp++;}
}
        System.out.println(temp);
    }
}

Measured memory_bytes: 22356
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main() 
{
	ll N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << (N + min({ A,B,C,D,E }) - 1) / min({ A,B,C,D,E }) + 4 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int pro = A*B;

    if(pro%2 == 0) {
      System.out.println("Even");
    }else {
      System.out.println("Odd");
    }
  }
}


Measured memory_bytes: 21972
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in range(101):
    for j in range(101):
        for h in range(101):
            X = [a-i for a in A]
            Y = [b-j for b in B]
            Z = [c-h for c in C]
            if  X == Y == Z:
                print('Yes')
                exit()
print("No") 

Measured memory_bytes: 43740
a = input()
b = input()
c = input()
t = "a"
while True:  
  if t == "a":
    if len(a) == 0:
    	print("A")
    	break
    t = a[0]
    a = a[1:]
  elif t == "b":
    if len(b) == 0:
    	print("B")
    	break
    t = b[0]
    b = b[1:]
  elif t == "c":
    if len(c) == 0:
    	print("C")
    	break
    t = c[0]
    c = c[1:]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  long N;
  cin >> N;
  string strx = to_string(N);
  int x;
  for (auto n : strx) {
    x += n - '0';
  }
  if (N % x) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


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

using namespace std;
using ll = long long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI = 4.0 * atan(1.0);

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

int main() {
    int A; cin >> A;
    int B; cin >> B;
   
    if ((A <= 9) && (B <= 9)) cout << A * B << endl;
    else cout << -1 << endl;
    return 0;
}


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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int k;
	cin >> k;
	queue<long long> q;
	for (int i = 1; i <= 9; i++) q.push(i);
	for (int i = 0; i < k - 1; i++) {
		long long x = q.front();
		q.pop();
		if (x%10) q.push(10*x + x%10 - 1);
		q.push(10*x + x%10);
		if (x%10 != 9) q.push(10*x + x%10 + 1);
	}
	cout << q.front();
}

Measured memory_bytes: 4748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
	ll out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		{
			fh=-1;
			jp=getchar();
		}
	while (jp>='0'&&jp<='9')
		{
			out=out*10+jp-'0';
			jp=getchar();
		}
	return out*fh;
}
ll gcd(ll a,ll b)
{
	return a%b==0?b:gcd(b,a%b);
}
ll solve(ll a,ll b,ll m)//the smallest x where x>=a,x%m=b
{
	if((a%m+m)%m>b)
		b+=m;
    return a+b-(a%m+m)%m;
}
int judge(ll a,ll b,ll c,ll d)
{
	if(b>a || b>d)
		return 0;
	ll GCD=gcd(b,d);
	return solve(c-b+1,a%GCD,GCD)>=0;
}
int main()
{
	int T=read();
	while(T--)
		{
			ll a=read(),b=read(),c=read(),d=read();
			if(judge(a,b,c,d))
				puts("Yes");
			else
				puts("No");
		}
	return 0;
}

Measured memory_bytes: 256
R,G,B,N = map(int,input().split())
ans = 0
for i in range(0,N//R+1):
  for j in range(0,(N-i*R)//G+1):
    k = N - i*R -j*G
    if k%B == 0 and k>= 0:
      ans += 1
print(ans)


Measured memory_bytes: 40684
class Restaurant
  attr_accessor :id, :city, :score
end

n = gets.to_i

restaurants = []

n.times do |i|
  city, score = gets.split(' ')
  r = Restaurant.new
  r.id = i+1
  r.score = score.to_i
  r.city = city
  restaurants << r
end
restaurants = restaurants.sort! do |a, b|
  (a.city <=> b.city).nonzero? ||
      (b.score <=> a.score)
end

restaurants.each do |r|
  puts r.id
end


Measured memory_bytes: 1788
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999

int M, D, ans = 0;

int main() {
	cin >> M >> D;
	for (int m = 1; m <= M; m++) {
		for (int d = 22; d <= D; d++)
			if ((d%10 >= 2 && d/10 >= 2) && ((d%10) * (d/10) == m))ans++;
	}
	cout << ans << endl;
	return 0;
}


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

static const int M = 1099997;
static const int L = 12;

char Hash[M][L];

int h1(int key)
{
    return key % M;
}

int h2(int key)
{
    return 1 + (key % (M-1) );
}

int h(int key, int i)
{
    return (h1(key) + i*h2(key) ) % M;
}

int getChar(char ch)
{
    if (ch == 'A')  return 1;
    else if (ch == 'T') return 2;
    else if (ch == 'C') return 3;
    else if (ch == 'G') return 4;
    else    return 0;
}

int getKey(char str[])
{
    int index = 0,
        x = 1;

    for (int i = 0; i != strlen(str); ++i)
    {
        index += x * (getChar(str[i]));
        x *= 5;
    }

    return index;
}

bool insert(char str[])
{
    int key = getKey(str);
    int index;

    for (int i = 0; ; ++i)
    {
        index = h(key, i);

        if (strcmp(Hash[index], str) == 0)
        {
            return false;
        }
        else
        {
            if (strlen(Hash[index]) == 0)
            {
                strcpy(Hash[index], str);
                return true;
            }
        }      
    }

    return true;
}

bool search(char str[])
{
    int key = getKey(str);
    int index;

    for (int i = 0; ; ++i)
    {
        index = h(key, i);

        if (strcmp(Hash[index], str) == 0)
        {
            return true;
        }
        else if (strlen(Hash[index]) == 0)
        {
            return false;
        }
    }
    return false;
}

int main()
{
    int n;
    bool flat;
    char str[L], com[10];

    for (int i = 0; i != M; ++i)
    {
        Hash[i][0] = '\0';
    }

    scanf("%d", &n);

    for (int i = 0; i != n; ++i)
    {
        scanf("%s", &com);
        scanf("%s", &str);

        if (com[0] == 'i')
        {
            insert(str);
        }
        else if (search(str))
        {
            printf("yes\n");
        }
        else
        {
            printf("no\n");
        }
        
    }

    return 0;
}


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

int main(int argc, char const *argv[])
{

	int a, b, c;
	std::string answer = "No";

	std::cin >> a >> b >> c;

	if (a<b&&b<c) {
		answer = "Yes";
	}

	std::cout << answer << std::endl;

	return 0;
}

Measured memory_bytes: 1196
import java.util.ArrayDeque

fun main(args: Array<String>) {
    val (N, D, A) = readInputLine().split(" ").map { it.toLong() }
    val mons = Array(N.toInt()) { val (X, H) = readInputLine().split(" ").map { it.toLong() }; Pair(X, H)}
    mons.sortBy { it.first }

    val damages = ArrayDeque<Pair<Long, Long>>()

    var ans = 0L
    var nowDamage = 0L

    for (m in mons) {
        while (damages.isNotEmpty()) {
            val (x, cnt) = damages.peek()!!
            if (x + D * 2 < m.first) {
                nowDamage -= cnt * A
                damages.poll()!!
            } else {
                break
            }
        }
        if (nowDamage >= m.second) {
            continue
        } else {
            val cnt = (m.second - nowDamage) / A + if ((m.second - nowDamage) % A != 0L) 1L else 0L
            damages.add(Pair(m.first, cnt))
            nowDamage += cnt * A
            ans += cnt
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 135932
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<vector<int>> a;
  for(int i=2;i<=N;++i){
    int k=i;
  	for(int j=2;j<=i;++j){
      if(k==1)break;
      if(k%j==0){
        auto f=find_if(a.begin(),a.end(),[&j](vector<int> aa){return aa[0]==j;});
        if(f!=a.end()){
          (*f)[1]++;
        }else{
          a.push_back(vector<int>{j,1});
        }
        k/=j;
        j--;
      }
    }
  }
  for(auto b:a){
    //cout<<b[0]<<" "<<b[1]<<endl; 
  }
  int num=0;
  for(auto b:a){
    if(b[1]<4)continue;
    for(auto c:a){
      if(c[1]<4)continue;
      if(b[0]>=c[0])continue;
      for(auto d:a){
        if(d[1]<2)continue;
        if(b[0]==d[0])continue;
        if(c[0]==d[0])continue;
        num++;
      }
    }
    if(b[1]<14)continue;
    for(auto c:a){
      if(b[0]==c[0])continue;
      if(c[1]<4)continue;
      num++;
    }
    if(b[1]<24)continue;
    for(auto c:a){
      if(b[0]==c[0])continue;
      if(c[1]<2)continue;
      num++;
    }
    if(b[1]>=74)num++;
  }
 
  cout<<num<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, q; string s; cin >> n >> s >> q;
    map<char, set<ll>> d;
    rep(i, n) d[s[i]].insert(i);
    rep(i, q){
        ll cmd; cin >> cmd;
        if(cmd == 1){
            ll idx; char c;
            cin >> idx >> c; idx--;
            if(s[idx] == c) continue;
            d[s[idx]].erase(idx);
            s[idx] = c;
            d[c].insert(idx);
        }
        else if(cmd == 2){
            ll l, r, cnt = 0; cin >> l >> r; l--; r--;
            for(char c = 'a'; c<='z'; c++){
                auto it = d[c].lower_bound(l);
                if(it == d[c].end()) continue;
                if(*it <= r) cnt++;
            }
            cout << cnt << endl;
        }
    }
}

Measured memory_bytes: 27236
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int ret = 0;
	int x;cin >> x;
	ret += x/500*1000;
	x %= 500;
	ret += x/5*5;
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3612
n,m = map(int,input().split())

t = list(map(int,input().split()))
ab=[]
for _ in range(m):
    a, b = (int(x) for x in input().split())
    ab.append([a,b])

t.sort(reverse=True)
ab = sorted(ab, key=lambda x: -x[1])
count = 0
for i,j in ab:
    t += [j]*i
    count += i
    if n <= count:
        break

t.sort(reverse=True)
        
print(sum(t[:n]))

Measured memory_bytes: 91672
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

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

sum_tmp = sum(a)
for i in range(q):
  b = bc[i][0]
  c = bc[i][1]
  A[c] += A[b]
  sum_tmp += (c-b) * A[b]
  A[b] = 0
  
  print(sum_tmp)

Measured memory_bytes: 92516
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int a[m+2];
	int i,s=0;
	for(i=0;i<m;i++)
	{
		cin>>a[i];
		s+=a[i];
	}
	if(s>n)
	cout<<"-1"<<endl;
	else
	cout<<n-s<<endl;
	return 0;
}

Measured memory_bytes: 3628