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


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


int main() 
{
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string ans;
    rep(i,n)
    {
        ans[i] = s[i];
        ans[i+1] = t[i];
        cout << ans[i] << ans[i+1];
    }
    

    return 0;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool comp(int a, int b){
    return (a<b);
}

int main(){
    string s; cin >>s;
    int cnt=0;
    REP(i, 0, 4){
        if(s[i]=='+') cnt++;
        else cnt--;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int t=0;
	while(1){
		int a,b;
		cin>>a>>b;
		if(a==0&&b==0)break;
		if(t)puts("");
		int fg=0;
		for(int  i=a;i<=b;i++){
			if(!(i%400)){
				cout<<i<<endl;
				fg=1;
			}
			else if(!(i%100))continue;
			else if(!(i%4)){
				cout<<i<<endl;
				fg=1;
			}
		}
		if(!fg)cout<<"NA"<<endl;
		t++;
	}
	return 0;
}
	

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

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

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int n = fs.nextInt();
		int[] weightArr = fs.nextIntArr(n);
		
		int allWeight = 0;
		for(int i = 0; i < n; i++) {
			allWeight += weightArr[i];
		}
		
		int ans = 1_000_000_007;
		for(int i = 0; i < n-1; i++) {
			int left = 0;
			for(int j = 0; j <= i; j++) {
				left += weightArr[j];
			}
			int right = allWeight - left;
			
			ans = Math.min(ans, Math.abs(left-right));
		}
		
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 32652
#include<stdio.h>
long long f(long long x,long long y)
{
    if(x==0) return -y;
    else return (y/x)*x*2 + f(y%x,x);
}
main()
{
    long long n,x;
    scanf("%lld%lld",&n,&x);
    printf("%lld",f(x,n-x)+n);
}


Measured memory_bytes: 128
// Problem : A - Takoyaki
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
ll power(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base);
       base=(base*base);
       exp/=2;
    }
    return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,x,t;
	cin>>n>>x>>t;
	ll v=ceil(float(n)/x);
	cout<<v*t<<"\n";
	return 0;
	}

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

int main() {
  int N; cin>>N;
  vector<ll> z(N), w(N);
  for(int i=0; i<N; ++i) {
    ll x, y; cin>>x>>y;
    z[i]=x+y; w[i]=x-y;
  }

  ll ans1 = (*max_element(z.begin(),z.end())-*min_element(z.begin(),z.end()));
  ll ans2 = (*max_element(w.begin(),w.end())-*min_element(w.begin(),w.end()));
  ll ans = max(ans1,ans2);
  cout << ans << endl;
}


Measured memory_bytes: 6376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		StringBuilder output = new StringBuilder();
		int count = 0;
		
		while(true) {
			int n = scan.nextInt();
			int x = scan.nextInt();
			
			if (n == 0 && x == 0) break;
			
			for (int i = 1; i <= n; i++) {
				for (int j = i+1; j <= n; j++) {
					for (int k = j+1; k <= n; k++) {
						if ((i + j + k) == x)
							count++;
					}
				}
			}
			output.append(count).append('\n');
			count = 0;
		}
		System.out.print(output);
		scan.close();
	}

}

Measured memory_bytes: 19640
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;



double dis(int i, int j, const vector<pair<int,int>> & pos ){
    return sqrt(pow(pos[i].first-pos[j].first,2)+pow(pos[i].second-pos[j].second,2));
}

int main(){
    long long n,m;
    long long sm =0;
    cin>>n>>m;
    for(long long i =0;i<m;i++){
        long long tmp ;
        cin >> tmp;
        sm+= tmp;
    }
    if(n < sm){
        cout << -1 << endl;
    }else{
        cout << n - sm << endl;
    }

    return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K;
    cin >> N >> K;
    if (N <= K) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> Hs(N);
    for (auto &&H : Hs)
        cin >> H;
    sort(Hs.begin(), Hs.end());
    long long sum = 0;
    for (int i = 0; i < N - K; ++i)
        sum += Hs[i];
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1656
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, L = MI()
    tot = 0
    for i in range(1, N+1):
        tot = tot + L + i - 1
    diff = INF
    ans = 0
    for i in range(1, N+1):
        tmp = tot - L - i + 1
        if abs(tot - tmp) < diff:
            diff = abs(tot - tmp)
            ans = tmp
    print(ans)

if __name__ == '__main__':
    solve()



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

int main() {
  string S;
  cin >> S;
    if (S == "a" or S == "i" or S == "u" or S == "e" or S == "o") {
      cout << "vowel" << endl;}
    else {
      cout << "consonant" << endl;}
}

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

using namespace std;

int main()
{
    string S;
    cin >> S;
    int length = S.size();
    long long ans=0, num;
    for(int i=0; i<(1 << (length-1)); ++i){
        //cout << ans << endl;
        num = S[0] - '0';
        for(int j=0;j<length-1;++j){
            if((i >> j) & 1){
                ans += num;
                num = S[j+1] - '0';
            }
            else{
                num = num*10 + (S[j+1] - '0');
            }
        }
        ans += num;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/*input
100000 100000
*/
#include "bits/stdc++.h"
#define ll long long
using namespace std;
const int MAXN = 1e5+9;
const ll mod=1e9+7;
ll fastexpo(ll base, ll expo)
{
	ll result=1;
	while(expo>0)
	{
		if(expo%2)
		{
			result=(result*base);
			result%=mod;
		}
		base=base*base;
		base%=mod;
		expo=(expo/2ll);
	}
	return result;
}
ll mult[MAXN],ans[MAXN];
int main()
{
	ll n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++)
	{
		for(int j=i;j<=k;j+=i)
		{
			mult[i]++;
		}
	}
	ll fans=0;
	for(int i=k;i>=1;i--)
	{
		ll total = fastexpo(mult[i],n);
		for(int j=2*i;j<=k;j+=i)
		{
			total-=ans[j];
			if(total<0)
			{
				total+=mod;
			}
		}
		ans[i]=total;
		fans+=(ans[i]*1ll*i)%mod;
		if(fans>=mod)
		{
			fans-=mod;
		}
	}
	cout<<fans<<endl;
	return 0;

}

Measured memory_bytes: 5152
#include<iostream>
using namespace std;
typedef long long ll;
ll n,cnt;
int main(){
  while(cin>>n&&n){
    cnt=0;
    for(ll i=5;i<=2000000000;i*=5){
      cnt+=n/i;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

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

typedef pair<int, int> P;
typedef long long ll;


#define REP(i, n) for(int i = 0; i < n; i++) //普通のループ
#define REPTO(i, n) for(int i = 0; i <= n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--) //逆ループ
#define FOR(i, m, n) for(int i = m; i < n; i++) //最初の数値を指定

int main(){
    int S,W;
    cin >> S >> W;
    if(W>=S) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

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

int n,T[100010][4];
int memo[100010][4];

int go(int ind,int last)
{
    if(ind == n) return 0;
    if(memo[ind][last]!=-1) return memo[ind][last];

    int ret = 0;

    for(int i = 0;i<3;i++){
        if(i == last) continue;
        ret = max(ret,T[ind][i]+go(ind+1,i));
    }
    return memo[ind][last] = ret;
}

int main()
{
    cin>>n;
    for(int i = 0;i<n;i++) for(int j = 0;j<3;j++) cin>>T[i][j];
    int ans = 0;
    //for(int i = 0;i<3;i++){
        memset(memo,-1,sizeof memo);
        ans = go(0,3);

    cout<<ans<<endl;
}

Measured memory_bytes: 11136
n, m = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
goukei = sum(l)
tokuhyo = goukei / (4 * m)
f = True
for i in range(m):
  if max(l) >= tokuhyo:
    goukei -= max(l)
    l.pop(l.index(max(l)))
  else:
    f = False    

if f:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3064
n = int(input())
a = list(map(int, input().split()))
su = 1
flag = True
if 0 in a:
    print(0)
else:
    for i in range(n):
        su *= a[i]
        if su > 10**18:
            flag = False
            break
    if flag:
        print(su)
    else:
        print(-1)

Measured memory_bytes: 84532
#include<stdio.h>
#include<string.h>
int main()
{
    int n,j,c;
    scanf("%d",&n);
    char s[10000];
    scanf("%s",&s);
    j=strlen(s);
    for(int i=0;i<j;i++){
        c = s[i] - 'A';
        s[i] = 'A' + (c+n)%26;

}
printf("%s",s);
return 0;
}

Measured memory_bytes: 1744
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    string s; cin>>s;
    if(s=="ABC")cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}





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

#nを素因数分解したリストを返す
def prime_factor(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


primes = prime_factor(N)

prime_dic = {}
for i in range(len(primes)):
    if primes[i] in prime_dic:
        prime_dic[primes[i]] += 1
    else:
        prime_dic[primes[i]] = 1

sum_list = [0 for _ in range(30)]
sum_list[0] = 1
for i in range(29):
    sum_list[i+1] += sum_list[i] + (i + 2)

ans = 0
for key in prime_dic:
    for i in range(30):
        if sum_list[i] > prime_dic[key]:
            ans += i
            break

print(ans)

Measured memory_bytes: 9244
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
typedef long long int ll;

int main() {
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a.at(i);

  vector<ll> sumv(n);
  sumv.at(0) = a.at(0);
  rep(i, n - 1) sumv.at(i + 1) = sumv.at(i) + a.at(i + 1);

  ll ans = 1000000000000000000;
  vector<ll> p{1, -1};
  rep(i, 2) {
    ll ans1 = 0;
    ll sousa = 0;
    rep(j, n) {
      if (p.at((i + j) % 2) == 1) {
        if (sumv.at(j) + sousa < 1) {
          ans1 += abs(1 - (sumv.at(j) + sousa));
          sousa += 1 - (sumv.at(j) + sousa);
        }
      } else {
        if (sumv.at(j) + sousa > -1) {
          ans1 += abs(1 + (sumv.at(j) + sousa));
          sousa -= 1 + (sumv.at(j) + sousa);
        }
      }
    }
    ans = min(ans, ans1);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define inf (1<<29)
#define MAX 60
using namespace std;

bool dp[MAX][MAX][2];
 
int main()
{
  int T;
  while(cin >> T)
    {
      while(T--)
	{
	  rep(i,MAX)rep(j,MAX)rep(l,2)dp[i][j][l] = false;
	  int N;
	  cin >> N;
	  int input[N];
	  rep(i,N) cin >> input[i];
       
	  if(N <= 2)
	    {
	      cout << input[N-1] << endl;
	      continue;
	    }
       
	  int ans = input[N-1];
 
	  REP(cur,1,N-1)
	    {
	      dp[input[cur-1]][input[cur]][cur&1] = true;
	      int R = input[cur+1];
	      rep(L,MAX)
		{
		  rep(M,MAX)
		    {
		      if(!dp[L][M][cur&1])continue;
		      //cout << cur << " cur(" << L << "," << M << "," << R << ")\n";
		      if(M == 0)
			{
			  if(cur+2 < N)
			    {
			      dp[M][R][(cur+1)&1] = true;
			      //cout << cur << " next ( " << M << "," << R << "," << input[cur+2] << ")\n";
			    }
			  else       ans = max(ans,R);
			}
		      else
			{
			  if(cur+2 < N)
			    {
			      dp[M][R][(cur+1)&1] = true;
			      //cout << cur << " next ( " << M << "," << R << "," << input[cur+2] << ")\n";
			      dp[M-1][R+L][(cur+1)&1] = true;
			      //cout << cur << " next ( " << M-1 << "," << R+L << "," << input[cur+2] << ")\n";
			    }
			  else 
			    {
			      ans = max(ans,R+L);
			      //cout << cur << " ans : " << R << "+" << L << "=" << R+L <<  " (" << L << "," << M << "," << R << ")" <<  endl;
			    }
			}
		    }
		}
	      rep(i,MAX)rep(j,MAX)dp[i][j][cur&1] = false;
	    }
	  
	  cout << ans << endl;      
	}
    }
  return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#define ll long long
#define MAXN 200005
#define INF 0x3f3f3f3f
#define ld long double
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    #define int ll
    int k,a,b;
    cin>>k>>a>>b;
    int num1=a/k;
    if(a%k==0)num1-=1;
    int num2=b/k;
    if(num2==num1){
        cout<<"NG"<<endl;
    }
    else{
        cout<<"OK"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main()
{
  int n,flag=0;
  cin>>n;
  for(int i=1;i<=9;i++)
    for(int j=1;j<=9;j++)
      if(i*j==n)
        flag=1;
  if(flag==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}  

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define ml cout<<endl
 
#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define mod 1000000007

#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
//ll ans;

// ll dfs(vi v ,ll m ){
//   if(visited[]) 
// }
int main(){
	ios_base::sync_with_stdio(false);
     	cin.tie(NULL);
    	cout.tie(NULL);    
    ll n,m;
    cin>>n>>m;
    if(n<=m){
        cout<<"unsafe"<<endl;
    }else{
        cout<<"safe"<<endl;
    }

	return 0;
}






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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,C;
int A[404],B[404];
ll mo=1000000007;
ll ppow[404][404];
ll ppowS[404][404];
ll dp[404][404];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>C;
	FOR(i,N) cin>>A[i];
	FOR(i,N) cin>>B[i];
	
	ppow[0][0]=1;
	for(i=1;i<=400;i++) {
		ppow[i][0]=1;
		FOR(j,400) ppow[i][j+1]=ppow[i][j]*i%mo;
	}
	FOR(i,401) FOR(j,401)  (ppowS[j+1][i]=ppowS[j][i]+ppow[j][i])%=mo;
	
	
	dp[0][0]=1;
	FOR(i,N) FOR(x,C+1) for(y=0;x+y<=C;y++) {
		ll p=(ppowS[B[i]+1][y]-ppowS[A[i]][y])%mo;
		if(p<0) p+=mo;
		(dp[i+1][x+y] += dp[i][x] * p) %= mo;
	}
	cout<<dp[N][C]<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 4096
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val D = Array(N) { mutableListOf<Int>() }
        repeat(N - 1) { i ->
            val u = sc.next().toInt()
            D[u - 1].add(i)
        }
        D.forEach { println(it.count()) }
    }
}


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

int a[10];
bool flag;

void dfs(int n, int l, int r){
	if(n == 10){
		flag = true;
		return;
	}

	if(a[n] > l){
		dfs(n+1, a[n], r);
	}
	if(a[n] > r){
		dfs(n+1, l, a[n]);
	}

	return;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 10; j++){
			cin >> a[j];
		}
		flag = false;
		dfs(0, 0, 0);
		if(flag){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  ll n;
  cin >> n;

  ll ans = 0;
  if (n % 2 == 1) ans = 0;
  else {
    ll d = 10;
    while (n / d > 0) {
      ans += n / d;
      d *= 5;
    }
  }

  cout << ans << endl;

  return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll R, G, B, N;
  cin >> R >> G >> B >> N;
  ll cnt=0;
  for(int i=0;i*R<=N;i++){
    for(int j=0;j*G<=N;j++){
      ll tmp = N - i*R -j*G;
      if(tmp>=0 and tmp%B==0){
        //cout << i << " " << j << " " << tmp/B << endl;
        cnt++;
      }
    }
  }

  cout << cnt;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s[110];
int p[110];
int n;
void check(string t){
	vector<int> v;
	for(int i=0;i<n;i++){
		if(s[i]==t){
			v.push_back(p[i]);
		}
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for(int i=0;i<v.size();i++){
		for(int j=0;j<n;j++){
			if(v[i]==p[j]){
				cout<<j+1<<endl;
				break;
			}
		}
	}
	return ;
}
int main(){
	cin>>n;
	vector<string> vv;
	for(int i=0;i<n;i++){
		cin>>s[i]>>p[i];
		vv.push_back(s[i]);
	}
	sort(vv.begin(),vv.end());
	vv.push_back("~");
	for(int i=0;i<vv.size()-1;i++){
		if(vv[i]!=vv[i+1])check(vv[i]);
	}
	return 0;
}

Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int x[SIZE],y[SIZE],h[SIZE];
int main(){
    int N;
    R(N);
    int sp_id=-1;
    REP(i,N){
        R(x[i],y[i],h[i]);
        if(h[i])sp_id=i;
    }
    FOR(i,0,100){
        FOR(j,0,100){
            int v=abs(x[sp_id]-i)+abs(y[sp_id]-j)+h[sp_id];
            bool err=0;
            REP(k,N){
                if(h[k]){
                    int g=abs(x[k]-i)+abs(y[k]-j)+h[k];
                    if(v!=g)err=1;
                }
                else{
                    int g=abs(x[k]-i)+abs(y[k]-j)+h[k];
                    if(g<v)err=1;
                }
            }
            if(!err){
                W(i,j,v);
                return 0;
            }
        }
    }
    return 0;
}


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

const int N = 1e6 + 100;

bool cmp(pair<int,int> a, pair<int,int> b) {
    return max(a.first, a.second) > max(b.first, b.second);
}

typedef long long LL;

struct BIT {
    int n;
    vector<LL> tree;
    void init(int n_) {
        n = n_;
        tree.assign(n+1,0);
    }
    void upd (int idx, int val) {
        while (idx <= n) {
            tree[idx] += val ;
            idx += idx & (-idx) ;
        }
    }
    LL query (int idx) {
        LL sum = 0 ;
        while (idx > 0) {
            sum += tree[idx] ;
            idx -= idx & (-idx) ;
        }
        return sum ;
    }
    LL Sum(int i, int j) {
        return query(j)-query(i-1);
    }
}B;

bool cmp_mx(tuple<LL,LL,LL> A, tuple<LL,LL,LL> B) {
    if(get<0>(A) != get<0>(B)) return get<0>(A) < get<0>(B);
    return get<1>(A)*get<2>(B) < get<1>(B)*get<2>(A);
}

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pair<int,int>> vec;
    LL S = 0;
    for(int i = 1; i <= n; i++) {
        int x, y;
        cin >> x >> y;
        vec.push_back({x, y});
        S += x;
    }
    sort(vec.begin(), vec.end(), cmp);
    vec.insert(vec.begin(), {0, 0});
    B.init(n);
    for(int i = 1; i <= n; i++) {
        B.upd(i, max(vec[i].first, vec[i].second));
    }
    vector<tuple<LL,LL,LL>> all_res;
    for(int i = 1; i <= n; i++) {
        B.upd(i, (LL)-max(vec[i].first, vec[i].second));
        int lo = 0, hi = n;
        while(hi > lo) {
            int mid = (hi+lo)/2;
            LL sum = B.query(mid);
            if(sum >= S - vec[i].second) hi = mid;
            else lo = mid+1;
        }
        if(B.query(lo) <= S) {
//            cout << "lo: " << lo << endl;
//            cout << "S: " << S << endl;
//            cout << "sum: " << B.query(lo) << endl;
            int cnt = lo;
            if(cnt >= i) cnt--;
            LL req = S - B.query(lo);
            if(req <= vec[i].second) all_res.push_back(make_tuple(cnt, req, vec[i].second));
        }
        B.upd(i, (LL)max(vec[i].first, vec[i].second));
    }
    sort(all_res.begin(), all_res.end(), cmp_mx);
    if(all_res.size() == 0) {
        cout << "0 1" << endl;
        return 0;
    }
    LL z = get<0>(all_res[0]);
    LL x = get<1>(all_res[0]);
    LL y = get<2>(all_res[0]);
    LL P = n * y - z * y - x, Q = y * n;
    LL g = __gcd(P, Q);
    P /= g;
    Q /= g;
    cout << P << " " << Q << endl;
    return 0;
}



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

int main() {
	long long a, b, n;
	cin >> a >> b >> n;
	
	vector<long long> divs;

	for (int i = 1; i <= sqrt(b); i++) {
		if (b % i == 0) {
			if (b / i == i) divs.push_back(b / i);
			else {
				divs.push_back(b / i);
				divs.push_back(i);
			}
		}
	}

	long long res = -1;

	for (auto div : divs) {
		if (div > n) break;
		div--;
		res = max(res, (long long)floor((a * div) / b) - (long long)(a * floor(div / b)));
	}

	if (n <= b) {
		for (int div = -3; div != 1; div++) {
			if((n + div) % b != 0)
			res = max(res, (long long)floor((a * (n + div)) / b) - (long long)(a * floor((n + div) / b)));
		}
	}

	cout << res;
}

Measured memory_bytes: 3728
#include<iostream>

using namespace std;

int main(){
  char num[3];
  
  cin >> num;
  
  if(num[0] == '7' || num[1] == '7' || num[2] == '7'){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using LL = unsigned long long;
LL gcd(LL a, LL b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
LL lcm(LL a, LL b) {
	LL g = gcd(a, b);
	return a / g * b; // Be careful not to overflow

}
int main() {
	LL n;
	LL a[100] = { 0 };
	cin >> n;
	if (n == 1) {
		LL hoge;
		cin >> hoge;
		cout << hoge;
		return 0;
	}
	for (LL i = 0; i < n; i++) {
		cin >> a[i];
	}
	LL temp = lcm(a[0], a[1]);
	for (LL i = 2; i < n; i++)
	{
		temp = lcm(temp, a[i]);
	}
	cout << temp;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <cctype>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

int main() {
	int h, w; cin >> h >> w;
	vector<vector<string>> c(h, vector<string>(w));
	string x;

	for (int i = 0; i < h; i++) {
		cin >> x;
		for (int j = 0; j < w; j++) {
			c[i][j] = x[j];
		}
	}
	for (int i = 0; i < h; i++) {
		//cin >> x;
		for (int j = 0; j < w; j++) {
			cout << c[i][j];
		}
		cout << endl;
		for (int j = 0; j < w; j++) {
			cout << c[i][j];
		}
		cout << endl;
	}



	cout << endl;
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = 1e18L +5;
using namespace std;


int main() {
	fastio;
	string a{},b{};
	cin>>a>>b;
	int n{(int)a.length()},m{(int)b.length()};
	int dp[n+1][m+1];
	for(int i=0; i <= n; i++){
	    for(int j=0; j<= m; j++){
	        if(i==0 or j==0)
	            dp[i][j]=0;
	        else if(a[i-1]==b[j-1])
	            dp[i][j]= dp[i-1][j-1]+1;
	        else
	            dp[i][j]= max(dp[i-1][j],dp[i][j-1]);
	    }
	}
	int index=dp[n][m];
	char lcs[index+1];
	lcs[index]='\0';
	while(n>0 && m>0){
	    if(a[n-1]==b[m-1]){
	        lcs[index-1]=a[n-1];
	        n--;    m--;
	        index--;
	    }
	    else if(dp[n-1][m]> dp[n][m-1])
	        n--;
	    else
	        m--;
	}
	cout<<lcs;
	return 0;
}

Measured memory_bytes: 35456
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
 
using namespace std;
 
#define N 1000000


int bfs();
int grid[100][100];
char maze[100][100];
int h,w;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int sx,sy,gx,gy;

int main(){

	int count=0;

	cin>>h>>w;

	sx=0;
	sy=0;

	gx=w;
	gy=h;

	int count_shape=0;
	int count_dot=0;

	REP(y,h){

		cin>>maze[y];
		REP(x,w){
			if(maze[y][x]=='#')count_shape++;
			if(maze[y][x]=='.')count_dot++;
		}
	}

	// cout<<count_shape<<endl;
	// cout<<count_dot<<endl;

	bfs();

	REP(y,h){
		REP(x,w){
			if(grid[y][x]==INF)grid[y][x]=0;
		}
	}


	// REP(i,h+3){
	// 	REP(j,w+3){
	// 		cout<<grid[i][j]<<" ";
	// 	}cout<<endl;
	// }

	int min_dist=grid[h-1][w-1];

	if(min_dist==0){
		cout<<-1<<endl;
	}else{
		cout<<count_dot-min_dist-1<<endl;
	}




}



int bfs(){

	queue<P> que;

	//grid内の初期化
	REP(y,h){
		REP(x,w){
			grid[y][x]=INF;
		}
	}

	//スタート地点の初期化
	que.push(P(sx,sy));
	grid[sy][sx]=0;


	while(que.size()){
		P p=que.front();
		que.pop();

		if(p.first==gx&&p.second==gy)break;

		REP(i,4){
			int nx=p.first+dx[i];
			int ny=p.second+dy[i];

			if(grid[ny][nx]!=INF)continue;
			if(nx<0||ny<0||nx>=w||ny>=h)continue;
			if(maze[ny][nx]=='#')continue;

			que.push(P(nx,ny));
			grid[ny][nx]=grid[p.second][p.first]+1;


		}
	}
	return grid[gy][gx];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,m,a,b,ans=0;
    cin>>n>>m;
    priority_queue<int> A;
    vector<int> B[100001];
    rep(i,n) cin>>a>>b,B[a].push_back(b);
    rep(i,m){
        for(auto j:B[i+1]) A.push(j);
        if(!A.empty()) ans+=A.top(),A.pop();
    }
    cout<<ans;
}

Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int N, M;
pair <int, int> X[100005];
vector <int> V[405];
bool Matrix[405][405];
int S[405];
int First[405];
void Read()
{
    cin >> N >> M;
    for(int i = 1; i <= M; i++)
        cin >> X[i].first >> X[i].second;
}

void Solve(int node)
{
    for(int i = 1; i <= N; i++)
    {
        First[i] = 0;
        V[i].clear();
    }
    First[node] = M + 1;
    //queue <int> Q;
    Matrix[node][node] = 1;
    for(int i = M; i >= 1; i--)
    {
        int x = X[i].first, y = X[i].second;
        V[x].push_back(i);
        V[y].push_back(i);
        if(First[x] == 0 && First[y] == 0)
            continue;
        if(First[x] != 0 && First[y] != 0)
        {
            S[node] = 1;
            return;
        }
        if(First[x] == 0)
            swap(x, y);
        First[y] = i;
        Matrix[node][y] = 1;
    }
}

void getAns()
{
    for(int i = 1; i <= N; i++)
        Solve(i);
    int ans = 0;
    for(int i = 1; i <= N; i++)
    {
        if(S[i] == 1)
            continue;
        for(int j = 1; j < i; j++)
        {
            if(S[j] == 1)
            continue;
            int val = 1;
            for(int k = 1; k <= N; k++)
            {
                if(Matrix[i][k] == 1 && Matrix[j][k] == 1)
                {
                    val = 0;
                    break;
                }
            }
            ans += val;
        }
    }
    cout << ans << "\n";
}
int main()
{
    Read();
    getAns();
    return 0;
}


Measured memory_bytes: 2560
n,m=map(int,input().split())
ab=[list(map(int, input().split())) for _ in range(m)]

graph = [[] for _ in range(n)]
for v in ab:
    graph[v[0]-1].append(v[1]-1)
    graph[v[1]-1].append(v[0]-1)
# print(graph)

from collections import deque

queue = deque([0])
d = [10**6] * n
d[0] = 0
while queue:
    v = queue.popleft()
    for i in graph[v]:
        if d[i]==10**6:
            d[i] = d[v] + 1
            queue.append(i)
# print(d)

print('POSSIBLE' if d[n-1]<=2 else 'IMPOSSIBLE')



Measured memory_bytes: 81616
fun main(arg: Array<String>) {
    val INF = 1L.shl(29)
    val (N, M, R) = listOfInt()
    val Ra = listOfInt(-1).toIntArray()
    val G = Array(N) { LongArray(N) { INF } }
    for (n in 0 until N) G[n][n] = 0
    repeat(M) {
        val (a, b, c) = listOfInt(-1, -1, 0)
        val C = c.toLong()
        if (G[a][b] > C) { G[a][b] = C; G[b][a] = C }
    }
//G.print("bofore")
    for (k in 0 until N) for (h in 0 until N) for (w in 0 until N) {
        G[h][w] = Math.min(G[h][w], G[h][k] + G[k][w])
    }
//G.print("after")
    var ans = INF
    val A = IntArray(R)
    fun Permutation(n: Int) {
        if (n == R) {
            val Rb = A.map { Ra[it] }
            var c = 0L
            for (r in 0 until R - 1) c += G[Rb[r]][Rb[r + 1]]
            if (ans > c ) ans = c
        } else {
            for (m in 0 until R) {
                if (A.slice(0 until n).all { it != m }) {
                    A[n] = m
                    Permutation(n + 1)
                }
            }
        }
    }
    Permutation(0)
    println(ans)
}
fun Array<IntArray>.print(title: String = "") {
    System.err.println(if (title.length > 0) title else this)
    for ((index, array) in this.withIndex()) {
        System.err.print("[${index}] ")
        System.err.println(array.joinToString(", "))
    }
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt(D: Int = 0) = listOfString().map { Integer.parseInt(it) + D }
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }


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

#define SZ 105
char str[SZ];

int main(){

    int len;
    scanf("%s", str);
    getchar();

    len = strlen(str);
    printf("%c%d%c\n", str[0], len - 2, str[len - 1]);

    return 0;
}


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

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

	vector<int> av(n + 2, 0);
	vector<long long> rw(n + 2, 0);
	for (int i = 1; i <= n; ++i) {
		cin >> av[i];
		rw[i] = abs(av[i] - av[i - 1]) + rw[i - 1];
	}
	rw[n + 1] = abs(av[n + 1] - av[n]) + rw[n];

	for (int i = 1; i <= n; ++i) {
		cout << rw[n + 1] - (rw[i + 1] - rw[i - 1]) + abs(av[i + 1] - av[i - 1]) << endl;
	}

	return 0;
}

Measured memory_bytes: 2432
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    N = ii()
    for i in range(1, 10):
        if N % i != 0:
            continue
        else:
            if N // i <= 9:
                print("Yes")
                return
    print('No')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
//
//  main.cpp
//
// https://atcoder.jp/contests/abc131/tasks/abc131_d

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char* argv[]) {
    int N;
    cin >> N;
    struct Task {
        int time;
        int limit;
        Task(int time, int limit): time(time), limit(limit) {}
    };
    vector<Task> tasks;
    for (int i = 0; i < N; i++) {
        int time;
        int limit;
        cin >> time >> limit;
        tasks.push_back(Task(time, limit));
    }
    sort(tasks.begin(), tasks.end(), [](Task& lhs, Task& rhs) { return lhs.limit < rhs.limit; });
    int now = 0;
    for (Task& task : tasks) {
        if (now + task.time > task.limit) {
            cout << "No" << endl;
            return 0;
        }
        now += task.time;
    }
    cout << "Yes" << endl;
}



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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

template<class T>
inline bool chmax(T& a, T b){if(a<b){a=b;return true;} return false;}

template<class T>
inline bool chmin(T& a, T b){if(a>b){a=b;return true;} return false;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,d,a,ans=0,sum=0;
	queue<pll> q;
	cin >> n >> d >> a;
	d*=2;
	vpll v(n);
	rep(i,n) cin >> v[i].first >> v[i].second;
	sort(all(v));
	rep(i,n){
		ll x=v[i].first;
		ll h=v[i].second;
		while(!q.empty() && q.front().first<x){
			sum-=q.front().second;
			q.pop();
		}
		h-=sum;
		if(h>0){
			ll tmp=(h+a-1)/a;
			ans+=tmp;
			ll dam=a*tmp;
			sum+=dam;
			q.emplace(x+d,dam);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			long[] array = new long[N];
			for(int i = 0; i < N; i++){ array[i] = sc.nextLong(); }
			
			Arrays.sort(array);
			
			int pos = Arrays.binarySearch(array, array[N - 1] / 2);
			
			if(pos > 0){
				System.out.println(array[N - 1] + " " + array[pos]);
			}else{
				int l = -(pos + 2);
				int r = -(pos + 1);
				
				if(l < 0){
					System.out.println(array[N - 1] + " " + array[r]);
				}else{
					final long l_diff = (array[N - 1] + 1) / 2 - array[l];
					final long r_diff = array[r] - (array[N - 1] + 1) / 2;
					
					if(l_diff <= r_diff){
						System.out.println(array[N - 1] + " " + array[l]);
					}else{
						System.out.println(array[N - 1] + " " + array[r]);
					}
				}
			}
				
			/*
			try(final PrintWriter pw = new PrintWriter(System.out)){
				
			}
			//*/
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 36224
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
int head[2001];
struct node{
	int to;
	int next;
}e[4002];
int n,x,y;
int cnt=1;
void addedge(int u,int v){
	e[cnt].to=v;
	e[cnt].next=head[u];
	head[u]=cnt;
	++cnt;
}
int dis[2001][2001];
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
bool vis[2001];
void dij(int s){
	for(int i=1;i<=n;++i)
		vis[i]=0;
	for(int i=1;i<=n;++i)
		dis[s][i]=0x7fffffff;
	dis[s][s]=0;
	q.push(make_pair(dis[s][s],s));
	while(!q.empty()){
		pair<int,int>fr=q.top();
		q.pop();
		int now=fr.second;
		if(vis[now])
			continue;
		vis[now]=true;
		int ndis=fr.first;
		for(int i=head[now];i;i=e[i].next)
			if(ndis+1<dis[s][e[i].to]){
				dis[s][e[i].to]=ndis+1;
				q.push(make_pair(dis[s][e[i].to],e[i].to));
			}
	}
}
int main(){
	cin>>n>>x>>y;
	for(int i=1;i<n;++i){
		addedge(i,i+1);
		addedge(i+1,i);
	}
	addedge(x,y);
	for(int i=1;i<=n;++i)
		dij(i);
	int cnt[n];
	for(int i=1;i<n;++i)
		cnt[i]=0;
	for(int i=1;i<n;++i)
		for(int j=i+1;j<=n;++j)
			++cnt[dis[i][j]];
	for(int i=1;i<n;++i)
		cout<<cnt[i]<<endl;
	return 0;
}

Measured memory_bytes: 16000