akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(void) {

    int N;
    int W, H;
    int x, y;
    int S, T;
    while (cin >> N, N) {
        cin >> W >> H;
        vector<vector<int>> masu(H, vector<int>(W));

        for (int i = 0; i < N; i++) {
            cin >> x >> y;
            masu[y-1][x-1] = 1;
        }

        int ans = 0;
        cin >> S >> T;
        for (int i = 0; i < H-T+1; i++) {
            for (int j = 0; j < W-S+1; j++) {
                int cnt = 0;
                for (int k = 0; k < T; k++) {
                    for (int l = 0; l < S; l++) {
                        cnt += masu[i+k][j+l];
                    }
                }
                // cout << "### start(" << j << ", " << i << "): " << cnt << endl;
                ans = max(ans, cnt);
            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3116
class Dice:
    def __init__(self, d1, d2, d3, d4, d5, d6):
        self.d1 = d1
        self.d2 = d2
        self.d3 = d3
        self.d4 = d4
        self.d5 = d5
        self.d6 = d6
 
    def output(self, a, b):
        if (a == self.d1 and b == self.d2) or (a == self.d2 and b == self.d6) \
         or (a == self.d6 and b == self.d5) or (a == self.d5 and b == self.d1):
            print(self.d3)
        elif (a == self.d2 and b == self.d1) or (a == self.d6 and b == self.d2) \
         or (a == self.d5 and b == self.d6) or (a == self.d1 and b == self.d5):
            print(self.d4)
        elif (a == self.d1 and b == self.d3) or (a == self.d3 and b == self.d6) \
         or (a == self.d6 and b == self.d4) or (a == self.d4 and b == self.d1):
            print(self.d5)
        elif (a == self.d3 and b == self.d1) or (a == self.d6 and b == self.d3) \
         or (a == self.d4 and b == self.d6) or (a == self.d1 and b == self.d4):
            print(self.d2)
        elif (a == self.d2 and b == self.d3) or (a == self.d3 and b == self.d5) \
         or (a == self.d5 and b == self.d4) or (a == self.d4 and b == self.d2):
            print(self.d1)
        elif (a == self.d3 and b == self.d2) or (a == self.d5 and b == self.d3) \
         or (a == self.d4 and b == self.d5) or (a == self.d2 and b == self.d4):
            print(self.d6)  

d1, d2, d3, d4, d5, d6 = map(int, input().split())
dice = Dice(d1, d2, d3, d4, d5, d6)
n = int(input())
for _ in range(n):
    a, b = map(int, input().split())
    dice.output(a, b)


Measured memory_bytes: 5612
// https://atcoder.jp/contests/abc170/tasks/abc170_d

#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n' 

const int maxn = 200500;
const int maxa_i = 1000500;
int a[maxn];
bool bad[maxa_i];
map<int, int> cnt;

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

    int N;
    cin >> N;

    for(int i = 1; i <= N; i++) {
        cin >> a[i];
        cnt[a[i]]++;

        if(cnt[a[i]] == 2) {
            bad[a[i]] = true;
            for(int j = a[i]; j <= 1e6; j += a[i]) {
                bad[j] = true;
            }
        }
    }

    sort(a+1, a+N+1);

    int ans = 0;
    for(int i = 1; i <= N; i++) {
        if(!bad[a[i]]) {
            ans++;
            
            for(int j = a[i]; j <= 1e6; j += a[i]) {
                bad[j] = true;
            }
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 14636
n,a,b=map(int,input().split())
x=n//(a+b)
y=n%(a+b)
print(a*x+min(y,a))
# if a==0:
#     print(0)
# else:
    # x=n//(a+b)
    # y=n%(a+b)
    # print(a*x+min(y,a))

Measured memory_bytes: 38384
#include <iostream>
using namespace std;
int main() {
  int S;
  cin >> S;
  bool f1 = false;
  bool f2 = false;
  if (S % 100 >= 1 && S % 100 <= 12) {
	  f1 = true;
	}
  if (S / 100 >= 1 && S / 100 <= 12) {
	  f2 = true;
	}
  if (f1 && f2) {
	  cout << "AMBIGUOUS" << endl;
	}
  else if (f1) {
	  cout << "YYMM" << endl;
	}
  else if (f2) {
	  cout << "MMYY" << endl;
	}
  else {
	  cout << "NA" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
// g++ hello.cpp -o hello & hello
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)  

#define MP make_pair
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void test();

int main()
{
//freopen("input.in","r",stdin);freopen("output.in","w",stdout);
int t=1;
//   cin>>t;
for(int i=1;i<=t;i++)
{    
//	cout<<"Case #"<<i<<": ";
	test();
cout<<endl;
}
return 0;
}
void test() 
{
    int n;
    cin>>n;
int arr[10001]={};
for(int i=1;i<=100;i++)
{
    for(int j=1;j<=100;j++)
    {
        for(int k=1;k<=100;k++)
        {

            int ex=i*i+j*j+k*k+i*j+j*k+i*k;
            if(ex<=n)
            arr[ex]++;
        }
    }
}
for(int i=1;i<=n;i++)
cout<<arr[i]<<" ";

}

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

int main() {
  int N,a;
  cin >> N;
  
  vector<int> button;
  for(int i=1;i<=N;i++){
    cin >> a;
    button.push_back(a);
  }
  
  int ite=1,count=0;
  bool flg = false;
  for(int i=1;i<N;i++){
    ite = button[ite-1];
    count++;
    if(ite==2){
      flg = true;
      break;
    }
  }
  if(flg){
    cout << count << endl;
  }else{
    cout << "-1" << endl;
  }
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
vector <vector<lint> > dp;
lint n,k,dizi[3020],maks=0;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	lint i,j,k,l;
	cin>>n>>k;
	dp.resize(n+10);
	for(i=0;i<n+10;i++) dp[i].resize(k+5);
	cin>>dizi[0];
	maks=dizi[0];
	for(i=0;i<=n;i++) dp[i][0]=1;
	for(j=0;j<=maks;j++) dp[0][j]=1;
	for(i=1;i<n;i++){
		cin>>dizi[i];
		maks+=dizi[i];
		for(j=1;j<=maks && j<=k; j++){
			if(j<=dizi[i]){
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mods;
			}else{
				dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-dizi[i]-1])%mods;
				if(dp[i][j]<0) dp[i][j]+=mods;
			}
		}
	}
	/*for(i=0;i<=n;i++){
		for(j=0;j<=k;j++) cout<<dp[i][j]<<" ";
		cout<<endl;
	}*/
	cout<<dp[n-1][k];
	
	
	
	
	return 0;
}


Measured memory_bytes: 86528
#include <bits/stdc++.h>
using namespace std;
int n, M = 1e9+7, dp[3000][3001];
char di [3001];
int main (){
    scanf("%i%s", &n, di); dp[0][1] = 1;
    for (int i = 1; i < n; ++i){
        for (int j = 1; j <= i+1; ++j) {
            dp[i][j] += dp[i][j-1]; dp[i][j]%=M;
            if (di[i-1] == '>'){
                int tmp = dp[i-1][i]-dp[i-1][j-1];
                if (tmp < 0) tmp += M;
                dp[i][j] += tmp;
            } else dp[i][j] += dp[i-1][j-1];
            dp[i][j]%=M;
            //printf("%i ", dp[i][j]);
        } //printf("\n");
    } printf("%i\n", dp[n-1][n]);
}

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

int main(){
  ll D, G;
  cin >> D >> G;
  vector<ll> p(D);
  vector<ll> c(D);
  for (ll i=0; i<D; i++) cin >> p.at(i) >> c.at(i);
  ll min_ac = 0;
  for (ll tmp=0; tmp < (1 << D); tmp++) {
    ll sum_score = 0;
    ll sum_ac = 0;
    vector<bool> all_ac(D, false);
    bool flag = false;
    bitset<10> s(tmp);
    for (ll i=0; i<D; i++) {
      if (s.test(i)) {
        sum_score += p.at(i)*100*(i+1) + c.at(i);
        sum_ac += p.at(i);
        all_ac.at(i) = true;
      }
    }
    if (sum_score < G) {
        for (ll i=D-1; i>=0; i--) {
            if (!(all_ac.at(i))) {
                for (int j=0; j<p.at(i)-1; j++) {
                    sum_score += 100*(i+1);
                    sum_ac++;
                    if (sum_score >= G) {
                        flag = true;
                        break;
                    }
                }
                break;
            }
        }
    }
    else flag = true;
    if (flag) {
        if (min_ac <= 0) min_ac = sum_ac;
        else {
            if (min_ac > sum_ac) min_ac = sum_ac;
        }
    }
  }
  
  cout << min_ac << endl;
}

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

const int MAXN = 5005;

int N, ga, sa, ba, gb, sb, bb;
int dp[MAXN];
long long dp2[MAXN];

int main(){
    scanf("%d %d %d %d %d %d %d", &N, &ga, &sa, &ba, &gb, &sb, &bb);

    for(int i = 0; i <= N; i++){
        if(i > 0)dp[i] = dp[i - 1] + 1;
        else dp[i] = 0;

        if(i - ga >= 0)dp[i] = max(dp[i], dp[i - ga] + gb);
        if(i - sa >= 0)dp[i] = max(dp[i], dp[i - sa] + sb);
        if(i - ba >= 0)dp[i] = max(dp[i], dp[i - ba] + bb);
    }

    for(int i = 0; i <= dp[N]; i++){
        if(i > 0)dp2[i % MAXN] = dp2[(i - 1) % MAXN] + 1;
        else dp2[i % MAXN] = 0;

        if(i - gb >= 0)dp2[i % MAXN] = max(dp2[i % MAXN], dp2[(i - gb) % MAXN] + ga);
        if(i - sb >= 0)dp2[i % MAXN] = max(dp2[i % MAXN], dp2[(i - sb) % MAXN] + sa);
        if(i - bb >= 0)dp2[i % MAXN] = max(dp2[i % MAXN], dp2[(i - bb) % MAXN] + ba);
    }
    printf("%lld\n", dp2[dp[N] % MAXN]);

    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = ReadLongArray();
            for (int i = 0; i <= 10000; i++)
            {
                var isA = (int)(i * 0.08) == AB[0];
                var isB = (int)(i * 0.1) == AB[1];
                if (isA && isB)
                {
                    Console.WriteLine(i);
                    return;
                }
            }

            Console.WriteLine(-1);
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 13396
#include <cstdio>
#include <vector>
using namespace std;
int main() 
{
    int n;
    while (scanf("%d",&n)&&n!=0) {
        vector<vector<int> > map;
        for (int i=0; i<n; i++) {
            vector<int> in(n+1);
            in[n]=0;
            for (int j=0; j<n; j++) {
                scanf("%d",&in[j]);
                in[n]+=in[j];
            }
            map.push_back(in);
        }
        vector<int> sum(n+1,0);
        for (int i=0; i<n+1; i++) {
            for (int j=0; j<n; j++) {
                sum[i]+=map[j][i];
            }
        }
        map.push_back(sum);
        for (int i=0; i<n+1; i++) {
            for (int j=0; j<n+1; j++) {
                printf("%5d",map[i][j]);
            }
            printf("\n");
        }
    }
}

        

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int a,b,ans1_l,ans1_h,ans2_l,ans2_h;
  	cin >> a >> b;
    if(a%2==0){
        ans1_l=a*100/8;
        ans1_h=(a+1)*100/8;
    }
    else if(a%2==1){
        ans1_l=a*100/8+1;
        ans1_h=(a+1)*100/8-1;
    }
    else{
        ans1_l=a*100/8+1;
        ans1_h=(a+1)*100/8;
    }
    ans2_l=b*10;
  	ans2_h=(b+1)*10-1;
    if(ans1_l>ans2_h||ans1_h<ans2_l)cout << -1 << endl;
    else cout << max(ans1_l,ans2_l) << endl;
}

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

#define  int        long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int n;
    cin>>n;
    if(n==1)
    {
        
            cout<<"0";
                exit(0);
    }
    vector<int>v;
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            v.pb(i);
            if(i*i !=n)
                v.pb(n/i);
        }
    }
    v.pb(n);
    sort(all(v));
    int a[sz(v)+1];
    f(i,0,sz(v))
        a[i]=0;
    f(i,0,sz(v)-1)
    {
        int c=1;
        for(int j=2;j*j<=v[i];j++)
            if(v[i]%j==0)
                c=0;
        if(c)
        {
            a[i]=1;
        }
    }
    int ans=0;
    f(i,0,sz(v)-1)
    {
        if(a[i]==0) continue;
        int c=0;
        while(n%v[i]==0)
        {
            c++;
            n=n/v[i];
        }
        int x= (sqrt(1+ 8*c)-1)/2;
        ans+=x;
    }
    cout<<ans;
}

Measured memory_bytes: 3676
#include <stdio.h>
int a,b;

int main(){
	scanf("%d %d", &a,&b);
	
	if(a >= b){
		if(a-b>=2){
			printf("%d", 2*a-1);
		}else{
			printf("%d", a+b);
		}
	}else{
		if(b-a>=2){
			printf("%d", 2*b-1);
		}else{
			printf("%d", a+b);
		}
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	string s;
	cin >> s;
	if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]){
		cout << "Yes" << endl;
	}else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]){
		cout << "Yes" << endl;
	}else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " <<a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("D:\\input.txt", "r", stdin);
	freopen("D:\\output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		string s;
		cin >> s;
		ll n = s.length();
		vi a(n + 1, 0);

		rep(i, 0, n)
		{
			if (s[i] == '<')
				a[i + 1] = max(a[i + 1], a[i] + 1);
		}
		per(i, n - 1, 0)
		{
			if (s[i] == '>')
				a[i] = max(a[i + 1] + 1, a[i]);
		}
		ll ans = 0;
		rep(i, 0, n + 1)
		ans += a[i];

		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 7716
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
using namespace std;

const int N = 3010;
vector<int> v, t;
long long memo[N][N];
long long mod = 1e9 + 7;

inline long long add_mod(long long a, long long b) {
  long long res = a + b;
  if(res > mod) res -= mod;
  if(res < 0) res += mod;
  return res % mod;
}

long long count_dp(int i, int j) {
  if(i == v.size() || j == t.size()) {
    return 1;
  }
  if(memo[i][j] != -1) return memo[i][j];
  long long ans = add_mod(add_mod(count_dp(i + 1, j), 
    count_dp(i, j + 1)), -count_dp(i + 1, j + 1));
  if(v[i] == t[j]) {
    ans = add_mod(ans, count_dp(i + 1, j + 1));
  }
  return memo[i][j] = ans;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m; cin >> n >> m;
  for(int i = 0; i < n; ++i) {
    int x; cin >> x;
    v.push_back(x);
  }

  for(int i = 0; i < m; ++i) {
    int x; cin >> x;
    t.push_back(x);
  }
  memset(memo, -1, sizeof memo);
  cout << count_dp(0, 0)<< endl;
}


Measured memory_bytes: 71296
#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector <string>
#define vvs vector <vector<string>>
#define pq  priority_queue<int>
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 2000000000;
const int MINF=-2000000000;
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll kind(vi SYURUI) {//vector<int>型の配列の要素の種類数
    int size = SYURUI.size();
    sort(all(SYURUI));
    int cnt = 1;
    rep(i, size-1) {
        if (SYURUI[i] != SYURUI[i + 1])cnt++;
    }
    return cnt;
}
/* ----------------------end----------------------- */
#pragma endregion

signed main() {
    int N, D, X; cin >> N >> D >> X;
    vi A(N); rep(i, N)cin >> A[i];
    int allcnt = 0;
    rep(i, N) {
        for (int j = 1; j <= D; j += A[i]) {
            allcnt++;
        }
    }
    cout << allcnt + X << endl;
}






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

namespace B_AdditionandMultiplication
{
    class Program
    {
        static void Main(string[] args)
        {
            int intN = int.Parse(Console.ReadLine()); // 操作回数入力値

            int intK = int.Parse(Console.ReadLine()); // 電光掲示板整数入力値

            int intAns = 1; // 電光掲示板整数1
            int i = 1;      // 操作回数


            // Aの操作
            while (i <= intN) {
                intAns *= 2;
                i++;
                if (intAns > intK) {
                    break;  
                }
            }


            // Bの操作
            while (i <= intN)
            {
                intAns += intK;
                i++;
            }

            Console.WriteLine(intAns);


        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

const char dayName[ 7 ][ 10 ] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };

int zeller( int, int, int );

int main( void ) {
	int mon, day;

	for ( ; scanf( "%d %d", &mon, &day ), mon; printf( "%s\n", dayName[ zeller( 2004, mon, day ) ] ) ) ;

	return 0;
}

int zeller( int y, int m, int d ) {
	if ( m < 3 ) {
		y--;
		m += 12;
	}
	
	return ( y + y / 4 - y / 100 + y / 400 + ( m * 13 + 8 ) / 5 + d ) % 7;
}

Measured memory_bytes: 584
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int x1 = tmp[0], y1 = tmp[1], x2 = tmp[2], y2 = tmp[3];

        int a = x2 - x1;
        int b = y2 - y1;

        // [0 -1  [a
        //  1  0]  b]
        int c = -b;
        int d = a;

        int x3 = x2 + c;
        int y3 = y2 + d;

        int x4 = x3 - a;
        int y4 = y3 - b;

        WriteLine($"{x3} {y3} {x4} {y4}");
    }
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, P;
  string S;
  cin >> N >> P >> S;
  int64_t res = 0;
  if (P == 2 || P == 5) {
    for (int i = 0; i < N; i++) {
      if ((S[i] - '0') % P == 0) res += i + 1;
    }
  } else {
    reverse(S.begin(), S.end());
    map<int, int> mp;
    mp[0] = 1;
    int cur = 0, b = 1;
    for (int i = 0; i < N; i++) {
      cur += (S[i] - '0') * b;
      cur %= P;
      b *= 10;
      b %= P;
      res += mp[cur]++;
    }
  }
  cout << res << '\n';
  return 0;
}


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

int main() {
  int n;
  cin >>n;
  
  vector<int>l(n);
  for(int i=0; i<n; i++){
    cin >>l[i];
    l[i]=l[i]*-1;
  }
  sort(l.begin(),l.end());
  int sum=0;
  for(int i=0; i<n; i++){
    sum-=l[i];
  }
  
  int max = -l[0];
  if(max < sum-max){
    cout <<"Yes" <<endl;
  }
  else{
    cout <<"No" <<endl;
  }
}		

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const int INF=1000100010;
int main(){
    int n;cin>>n;
    int num[n]={0};
    rep(i,n-1){
        int a;
        cin>>a;
        num[a-1]++;
    }
    for(int i=0;i<n;i++)cout<<num[i]<<endl;
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;

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

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

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

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

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

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

const int mod = 2019;

int main()
{
    int L,R;
    while (cin >> L >> R) {
        VI A;
        for (int i = 0; i < min(2*mod+5,R+1-L); i++)
            A.push_back((L+i)%mod);
        const int n = A.size();
        int ans = mod;
        FOR(i,0,n) FOR(j,i+1,n)
            ans = min(ans, A[i]*A[j] % mod);
        cout << ans << endl;
    }
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    int n = s.size();
    if (s[0]!='A'){
        cout<<"WA\n";
        return 0;
    }
    int cnt=0;
    FOR(i,2,n-2){
        if (s[i]=='C') cnt++;
    }
    if (cnt!=1){
        cout<<"WA\n";
        return 0;
    }
    FOR(i,1,n-1){
        if (!(('a'<=s[i]&&s[i]<='z') || s[i]=='C')){
            cout<<"WA\n";
            return 0;
        }
    }
    cout<<"AC\n";
    return 0;
}


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

As , Bs, Cs = [], [], []

for _ in range(N):
  a, b, c = map(int, input().split())
  As.append(a)
  Bs.append(b)
  Cs.append(c)

Ha = [-1 for _ in range(N)]
Hb = [-1 for _ in range(N)]
Hc = [-1 for _ in range(N)]

Ha[0] = As[0]
Hb[0] = Bs[0]
Hc[0] = Cs[0]

for i in range(1, N):
  Ha[i] = max(Hb[i-1] + As[i], Hc[i-1] + As[i])
  Hb[i] = max(Ha[i-1] + Bs[i], Hc[i-1] + Bs[i])
  Hc[i] = max(Ha[i-1] + Cs[i], Hb[i-1] + Cs[i])

print(max(Ha[N-1], Hb[N-1], Hc[N-1]))


Measured memory_bytes: 73176
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>
#include<math.h>

using namespace std;

int main(){

	string s;
	cin >> s;
	string ans;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '0'){
			ans += '0';
		}
		else if(s[i] == '1'){
			ans += "1";
		}
		else if(s[i] == 'B'){
			if(ans.size() == 0){
				//
			}
			else{
				ans.pop_back();
			}
		}
	}
	cout << ans <<endl;

	return 0;
}

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

int main(){
	// sengen
	int a,b,c;
	
	// nyuryoku
	cin >> a >> b >> c;
	// keisan
	if(a+b+c >21){
		cout << "bust" << endl;
	}else{
		cout << "win" << endl;
	}
}

Measured memory_bytes: 256
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define MOD 1000000007

long long int res[3010][3010][4] = {};
long long int v[3010][3010] = {};

int main()
{
    int r, c, k;
    cin >> r >> c >> k;
    for (int i = 0; i < k; i++)
    {
        int r, c, tmpv;
        cin >> r >> c >> tmpv;
        r--;
        c--;
        v[r][c] = tmpv;
    }
    for (int i = 0; i <= r; i++)
    {
        for (int j = 0; j <= c; j++)
        {
            for (int l = 0; l <= 3; l++)
            {
                // cout << i << " " << j << " " << l << " " << res[i][j][l] << endl;
                res[i + 1][j][0] = max(res[i + 1][j][0], res[i][j][l]);
                res[i][j + 1][l] = max(res[i][j + 1][l], res[i][j][l]);
                if (l + 1 <= 3)
                {
                    res[i + 1][j][0] = max(res[i + 1][j][0], res[i][j][l] + v[i][j]);
                    res[i][j + 1][l + 1] = max(res[i][j + 1][l + 1], res[i][j][l] + v[i][j]);
                }
            }
        }
    }
    cout << max({res[r][c][0], res[r][c][1], res[r][c][2]}) << endl;
}

Measured memory_bytes: 356556
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

ll gcd(ll x, ll y){return y == 0 ? x : gcd(y,x%y);}

vector<ll> a;
int n;


ll seg_gcd(int l, int r){
    ll g;
    if (l > 0) g = a[0];
    else g = a[r];
    rep(i,l) {
        g = gcd(g, a[i]);
    }
    for (int i = r; i < n; i++) {
        g = gcd(g, a[i]);
    }
    return g;
}

ll solve(int l, int r) {
    ll res = 0;
    for (int x = l; x < r; x++) {
        res = max(res,seg_gcd(x, x+1));
    }
    return res;
}


int main(void){
    cin >> n;
    a.resize(n);
    rep(i,n) cin >> a[i];
    int l = 0, r = n;
    while (l+1 < r) {
        if (r-l < 10) {
            cout << solve(l, r) << endl;
            return 0;
        }
        int mid = (l+r)/2;
        ll res1 = seg_gcd(l, mid);
        ll res2 = seg_gcd(mid, r);
        // debug(l);
        // debug(r);
        // debug(res1);
        // debug(res2);
        if (res1 > res2) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout << seg_gcd(l, r) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    ll n;cin>>n;
    ll t[n],a[n];
    rep(i,0,n-1)cin>>t[i];
    rep(i,0,n-1)cin>>a[i];
    if(n==1){
        if(a[0]==t[0]){
            cout<<1<<endl;
        }else{
            cout<<0<<endl;
        }
        return 0;
    }
    ll ans[n];rep(i,0,n-1)ans[i]=0;
    ans[0]=t[0];
    rep(i,1,n-1){
        if(t[i]!=t[i-1]){
            ans[i]=t[i];
        }
    }
    if(ans[n-1]!=0 && ans[n-1]!=a[n-1]){
        cout<<0<<endl;
        return 0;
    }
    ans[n-1]=a[n-1];
    for(ll i=n-2;i>=0;i--){
        if(a[i]<ans[i]){
            cout<<0<<endl;
            return 0;
        }
        if(a[i]!=a[i+1]){
            if(ans[i]==0){
                ans[i]=a[i];
            }else if(ans[i]==a[i]){
                continue;
            }else{
                cout<<0<<endl;
                return 0;
            }
        }
    }
    ll x=1;
    rep(i,0,n-1){
        if(ans[i]!=0){
            continue;
        }
        x=(x*min(t[i],a[i]))%i_7;
    }
    //rep(i,0,n-1)cout<<ans[i]<<' ';
    cout<<x<<endl;
    
    return 0;
}



Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int n,m,c;
int a[50],b[50];
bool g[50][50];
bool vi[50];
void dfs(int v){
  vi[v]=true;
  for(int v2=0;v2<n;v2++){
    if(!g[v][v2]) continue;
    if(vi[v2]) continue;
    dfs(v2);
  }
}
int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i];
    a[i]--,b[i]--;
    g[a[i]][b[i]]=g[b[i]][a[i]]=true;
  }
  for(int i=0;i<m;i++){
    g[a[i]][b[i]]=g[b[i]][a[i]]=false;
    for(int j=0;j<n;j++) vi[j]=false;
    dfs(0);
    bool br=false;
    for(int j=0;j<n;j++) if(!vi[j]) br=true;
    if(br) c++;
    g[a[i]][b[i]]=g[b[i]][a[i]]=true;
  }
  cout<<c;
}


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

int main(void)
{
	long long n, i, m, k;
	scanf("%lld", &n);
	i=1;
	while(i*i<=n){
        if(n%i==0){
		    m=i;
        }
        i=i+1;
	}
    k=n/m;
    printf("%lld", m+k-2);
    return 0;
}

Measured memory_bytes: 128
//
//  main.cpp
//  d.cpp
//
//  Created by teppeieda on 2017/08/20.
//  Copyright © 2017 teppeieda. All rights reserved.
//

#include <iostream>
#include <vector>
#define MAX 100005
using namespace std;
using ll = long long;

using edge = struct{int node; ll w;};
ll d[MAX];
vector<edge> tree[MAX];

void dfs(int n, int p, ll v) {
    d[n] = v;
    for (auto k : tree[n]) {
        if (k.node == p) {
            continue;
        }
        dfs(k.node, n, v + k.w);
    }
}

int main(int argc, const char * argv[]) {
    int N, a, b, c;
    cin >> N;
    for (int i = 0; i < N-1; i++) {
        cin >> a >> b >> c;
        tree[a].push_back({b,c});
        tree[b].push_back({a,c});
    }
    
    int Q, K;
    cin >> Q >> K;
    dfs(K, -1, 0);
    
    for (int i = 0; i < Q; i++) {
        int x,y;
        cin >> x >> y;
        cout << d[x] + d[y] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool ok[15][15][15]={false};
int main(){
  ll n,ans=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++) {
      for(int k=0;k<10;k++) {
        bool f1=false,f2=false;
        for(int l=0;l<n;l++){
          if(f1&&f2&&(int)(s[l]-'0')==k){
            ans++;
            break;
          }
          else if(f1&&(int)(s[l]-'0')==j){
            f2=true;
          }
          else if((int)(s[l]-'0')==i) f1=true;
        }
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
a = list(input().split())
stack = []

for i in range(0, len(a)):
    if a[i].isdigit():
        stack.append(int(a[i]))
    else:
        b = stack.pop()
        c = stack.pop()
        if a[i] == '+':
            stack.append(c+b)
        elif a[i] == '-':
            stack.append(c-b)
        elif a[i] == '*':
            stack.append(c*b)

print(stack.pop())


Measured memory_bytes: 5604
#include<set> 
#include<map> 
#include<stack> 
#include<cmath> 
#include<cstdio> 
#include<queue> 
#include<vector> 
#include<climits> 
#include<cstring> 
#include<iostream> 
#include<algorithm> 
using namespace std; 
#define LL long long 
#define MAXN 100000
#define INF INT_MAX 
int read(){ 
    int f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();} 
    return f*x; 
}
int f[MAXN+5],a[100]={1,0},len=1;
int main(){
	int n=read();
	memset(f,0x3f,sizeof(f));
	f[0]=0;
	for(int i=6;i<=MAXN;i*=6) a[++len]=i;
	for(int i=9;i<=MAXN;i*=9) a[++len]=i;
	for(int i=0;i<=len;i++)
		for(int j=a[i];j<=n;j++)
			f[j]=min(f[j],f[j-a[i]]+1);
	printf("%d\n",f[n]);
    return 0; 
} 


Measured memory_bytes: 640
/*************************************************************************
    > File Name: A.cpp
    > Author: Roundgod
    > Mail: wcysai@foxmail.com 
    > Created Time: 2018-12-15 20:00:53
 ************************************************************************/

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
string str;
ll ans;
int main()
{
    cin>>str;
    ll n=str.size();
    ll cnt=0;
    for(ll i=0;i<n;i++)
    {
        if(str[i]=='W') ans+=cnt;
        else cnt++;
    }
    printf("%lld\n",ans);
    return 0;
}



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

int main() {
    int n; cin >> n;
    string s;
    unordered_map<string , int> ump;
    ll ans = 0;
    rep(i, n) {
        cin >> s;
        sort(s.begin(), s.end());

        if (ump.count(s)) {
            ump[s]++;
            ans+= ump[s];
        }
        else {
            ump[s] = 0;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 10660
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string str;
  int q;
  cin >> str;
  cin >> q;
  while(q--){
    string s;
    cin >> s;
    int a, b;
    cin >> a >> b;
    if(s == "print"){
      cout << str.substr( a, b - a + 1) << endl;
    } else if(s == "reverse"){
      reverse( str.begin() + a, str.begin() + b + 1);
    } else {
      string p;
      cin >> p;
      str.replace( a, b - a + 1, p);
    }
  }
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
int main(){
long long N,K;
  cin>>N>>K;
  double s[200020];
  double p[200020];
  for(int i=0; i<N; i++){
cin>>p[i];
  }
  s[0]=0;
  for(int i=0; i<N; i++){
      double t=(1+p[i])/2;
    s[i+1]=s[i]+t;
  }
  double u=0;
  for(int i=0; i<N-K+1; i++){
      u=max(u,s[i+K]-s[i]);
  }

  cout<<fixed<<setprecision(33)<<u<<endl;
}

Measured memory_bytes: 3328
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
table = { "r": p, "s": r, "p": s }

score = [0] * n
for i in range(n):
    if i-k < 0:
        score[i] = table[t[i]]
        continue
    if t[i-k] == t[i] and score[i-k] != 0:
        score[i] = 0
    else:
        score[i] = table[t[i]]

print(sum(score))


Measured memory_bytes: 4788
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    FAST();
    ll n,i,j,k,a=0,b=0;
    cin>>n;
    j=n;
    while(n)
    {
        a+=n%10;
        n=n/10;
    }
    if(j%a==0)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;

    return 0;
}


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

int main() 
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i<n; i++)
        cin >> v[i];
    sort(v.begin(), v.end());
    int sum = 0;
    for (int i=0; i<n-1; i++)
        sum += v[i];
    cout << (sum>v[n-1]?"Yes":"No");
    return 0;
}

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

#define ll long long
#define MAX 300005
#define pp pair<ll, pair<ll, ll>>
#define pb push_back
#define mod 1000000007

using namespace std;

/*
 * author: Kruti_20
 */

ll power(ll x, ll y);

ll gcd(ll a, ll b);


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    cout<<(n*(n-1))/2;
    return 0;
}

ll power(ll x, ll y) {
    ll res = 1;
    x = x % mod;
    while (y > 0) {
        if (y & 1) res = (res * x) % mod;
        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k,s;
	scanf("%d %d %d",&n,&k,&s);
	int inf = 1e9;
	if (s == inf) inf--;
	for (int i = 1; i <= k; i++) printf("%d%s" , s , i == n ? "\n" : " ");
	for (int i = k + 1; i <= n; i++) printf("%d%s" , inf , i == n ? "\n" : " ");
} 

Measured memory_bytes: 3832
#include <stdio.h>
int main() {
	int n,k,pt;
	double p=0,sump=0;
	scanf("%d%d", &n,&k);
	for (int i = 1; i <= n; i++) {
		pt=i;
		p=1.0/n;
		while (pt<=k-1) {
			pt*=2;
			p*=0.5;
		}
		sump+=p;
	}
	printf("%.10f\n", sump);
	return 0;
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <utility>
using namespace std;
#define omajinai ios::sync_with_stdio(false);cin.tie(nullptr);

#pragma region typedef 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ld PI = 3.141592653589793;
const ll INF18 = 1e18;
#pragma endregion

#pragma region function
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;
}
#pragma endregion

ll h[100010];
ll dp[100010];

int main(){
omajinai;
    int n; cin >> n;
    rep(i, n) cin >> h[i];
    rep(i, 100010) dp[i] = INF18;
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if(i > 1){
            chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }
    cout << dp[n-1];
return 0;
}

Measured memory_bytes: 5184
#include <iostream>
#include <algorithm>
#include <map>

#define exp __exp
#define pow __pow
using LL = long long;
using LD = long double;
const int LN = 30;
const int mod = 1000000007;
const int phimod = mod - 1;
int tc, tot, ans;
LL n, k, base[LN], exp[LN];
std::map<LL, int> divisor;
int pow(int x, int y) {
	int ans = 1;
	for (; y; y >>= 1, x = static_cast<LL> (x) * x % mod)
		if (y & 1) ans = static_cast<LL> (ans) * x % mod;
	return ans;
}
void reduce(int &x) {
	x += x >> 31 & mod;
}
int phi(int n) {
	int ret = n;
	for (int i = 2; i * i <= n; ++i) if (n % i == 0) {
		ret = ret / i * (i - 1);
		do n /= i; while (n % i == 0);
	}
	if (n > 1) ret = ret / n * (n - 1);
	return ret;
}
LL mul(LL x, LL y, LL mod) {
	LL ret = (x * y - static_cast<LL> (static_cast<LD> (x) * y / mod + 0.5) * mod) % mod;
	return ret + (ret >> 63 & mod);
}
LL pow_(LL x, LL y, LL mod, LL ans = 1) {
	for (; y; y >>= 1, x = mul(x, x, mod))
		if (y & 1) ans = mul(ans, x, mod);
	return ans;
}
const int primes[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 };
bool prime_test(LL n) {
	LL e = n - 1 >> __builtin_ctzll(n - 1);
	for (int i = 0; i < 12; ++i) {
		int p = primes[i];
		if (n == p) return 1;
		for (LL d = e, lst = pow_(p, d, n), now; d != n - 1; lst = now, d <<= 1) {
			now = mul(lst, lst, n);
			if (now == 1 && lst != 1 && lst != n - 1) return 0;
		}
		if (pow_(p, n - 1, n) != 1) return 0;
	}
	return 1;
}
void pollard_rho(LL n) {
	if (n == 1) return;
	if (prime_test(n)) { ++divisor[n]; return; }
	for (; ; ) {
		LL x = std::rand(), c = std::rand(), y = x, now = 1;
		int i = 0, k = 1;
		while (i <= 1E5) {
			x = mul(x, x, n) + c;
			LL tmp = mul(now, std::abs(x - y), n);
			if (tmp) now = tmp;
			if (!(i & 127)) {
				LL d = std::__gcd(now, n);
				if (d > 1 && d < n) { pollard_rho(d), pollard_rho(n / d); return; }
			}
			if (x == y) break;
			if (++i == k) y = x, k <<= 1, now = 1;
		}
	}
}
int f(LL n) {
	int ans = 1;
	ans = static_cast<LL> (ans) * pow(k, (n + 1 >> 1) % phimod) % mod;
	ans = static_cast<LL> (ans) * ((n & 1 ? n : n >> 1) % mod) % mod;
	return ans;
}
void dfs(int dep, LL val, LL miu) {
	if (dep == tot) {
		if ((val & 1) || !(n / val & 1))
			reduce(ans += miu % mod * f(n / val) % mod - mod), reduce(ans);
		return;
	}
	for (int i = 0; i <= exp[dep]; ++i) {
		dfs(dep + 1, val, miu), val *= base[dep];
		if (!i) miu = miu * (1 - base[dep]);
	}
}
int solve() {
	divisor.clear(), pollard_rho(n), tot = ans = 0;
	for (auto pk : divisor) base[tot] = pk.first, exp[tot++] = pk.second;
	dfs(0, 1, 1);
	return ans;
}
int main() {
	std::cin >> n >> k, k %= mod, std::cout << solve() << '\n';
	return 0;
}

Measured memory_bytes: 256
object Scanner {
  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}

object Main extends App{
  val h,w = Scanner.nextInt()
  val s = Array.fill(h)(Scanner.next().toCharArray)
  val result = (0 until h).forall(i=>{
    (0 until w).forall(j=>{
      if (s(i)(j)=='#') {
        val b1 = if (i > 0) {
          s(i - 1)(j) == '#'
        } else {
          false
        }
        val b2 = if (i < h - 1) {
          s(i + 1)(j) == '#'
        } else {
          false
        }
        val b3 = if (j > 0) {
          s(i)(j - 1) == '#'
        } else {
          false
        }
        val b4 = if (j < w - 1) {
          s(i)(j + 1) == '#'
        } else {
          false
        }
        b1 || b2 || b3 || b4
      } else {true}
    })
  })
  if (result){
    println("Yes")
  } else {
    println("No")
  }
}

Measured memory_bytes: 25388
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i acc =
        if i = n then acc else
            let acc = if i mod 2 = 0 && a.(i) mod 2 = 1 then acc + 1 else acc in
            loop (i + 1) acc
    in
    loop 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 3832