akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn= new Scanner(System.in);
		 long x = scn.nextInt();
		 long val=x/500;
		 long val2 =(x%500);
		 long ans = (val*1000)+((val2/5)*5);
		 System.out.println(ans);

	}

}

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

int main() {
  int D,G,i,ans=10000;
  cin>>D>>G;
  vector<int> p(D),c(D);
  for(i=0;i<D;i++)cin>>p[i]>>c[i];
  
  for(int tmp=0;tmp<(1<<D);tmp++){
    bitset<10> x(tmp);
    int scr=0,sum=0,m=-1;
    
    for(i=0;i<D;i++){
      if(x.test(i)){
        scr+=100*(i+1)*p[i]+c[i];
        sum+=p[i];
      }else{m=i;}
      if(sum>=ans||scr>=G)break;
    }
    
    if(scr<G&&sum<ans){
      if(scr+p[m]*100*(m+1)>=G){
        sum+=(G-scr+100*m)/(100*(m+1));
        scr=G;
      }
    }
    
    if(scr>=G)ans=min(ans,sum);
    //cout<<sum<<","<<ans<<","<<scr<<endl;
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
# coding: utf-8 
a,b,c = [int(i) for i in input().split(" ")]
flag = False
amari = a % b
limit = b
for x in range(1,limit):
    if (amari * x) % b == c:
        flag = True
        break
if flag is True:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  int a[n];
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  int ans = 0;
  for(int i = 1; n >= i; i++){
    if(a[i-1] == i){
      swap(a[i-1],a[i]);ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**6)

def dfs(G, v):
    seen[v] = True

    for nv in G[v]:
        if seen[nv]:
            continue
        point[nv] += point[v]
        dfs(G, nv)

n, q = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n-1):
    x, y =  map(int, input().split())
    x, y = x-1, y-1
    G[x].append(y)
    G[y].append(x)

seen = [False for _ in range(n)]
root = 0
point = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    point[p-1] += x

dfs(G, root)
print(*point)

Measured memory_bytes: 234688
///   ***   ---   |||         In the name of ALLAH        |||   ---   ***   ///



#include<bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
    optimize();

    int n, cnt = 0;
    string s;
    cin >> n >> s;

    for ( int i = 0; i+2 < n; i++ ) {
        if ( s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C' ) cnt++;
    }

    cout << cnt << endl;


    return 0;
}


















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

int main(){
	int sum=0,n,x,a=1;
	cin >> n >> x;
	for (int i=0; i<n; ++i){
		int z;
		cin >> z;
		sum += z;
		if (sum > x) break; 
		++a;
	}
	cout << a;
}

Measured memory_bytes: 256
s=list(input())
flg=0
for i in range(len(s)):
  if i%2==0: #KISU
    if s[i] =='L':
      flg=1
  elif i%2!=0: #GUSU
    if s[i] =='R':
      flg=1
if flg==1:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll a;
  cin >> a;
  cout << a*(a*(a+1)+1) << newl;
  return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
using namespace std;
int main(void){
    int a,b,x=1;
    cin>>a>>b;
    for(int i=0;i<a;i++){
        if(x<b)x*=2;
        else x+=b;
    }
    cout<<x<<endl;
}


Measured memory_bytes: 256
import numpy as np

a, b, x = map(int, input().split())

#平面図形で考える
x /= a

# over half of bottle
if x <= a * b / 2:
	theta = np.arctan2(b * b, 2 * x)
# under half of bottle
else:
	theta = np.arctan2(2 * (a * b - x),a * a)

print(theta * 180 / np.pi)


Measured memory_bytes: 12488
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const unordered_map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define dbg(x) cout<<#x<<" = "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 4e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time"<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//_______________________________________________________________________________________
const int N = 3003;
ll dp[N][N];
ll n,s;
ll a[N];
ll f(int i,int j)
{
       if(j<0){return 0;}
       if(i==n){
              if(j==0){return 1;}
              return 0;
       }
       if(dp[i][j] != -1){return dp[i][j];}
       return dp[i][j] = (f(i+1,j-a[i])+2*f(i+1,j))%mod2;
}
int main()
{
       cin>>n>>s;
       fri(i,0,n)cin>>a[i];
       memset(dp,-1,sizeof dp);
       cout<<f(0,s)<<endl;
}


Measured memory_bytes: 74248
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author KY2001
 */


#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define Max(x) *max_element(ALL(x))
#define Min(x) *min_element(ALL(x))
#define Lower_bound(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define Upper_bound(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}

class CSugarWater {
public:
  int solve(std::istream &cin, std::ostream &cout) {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    double ans = 0;
    int ans_S = 0;
    int ans_W  = 0;
    vector<bool> S(3001);
    vector<bool> W(3001);
    FOR(i, 0, 3001){
      FOR(j, 0, 3001){
        if (100*A*i + 100*j*B <= 3000){
          W[100*A*i + 100*j*B] = true;
        }
      }
    }
    FOR(i, 0, 3001){
      FOR(j, 0, 3001){
        if (C*i+D*j<=3000){
          S[C*i+D*j] = true;
        }
      }
    }
    FOR(i, 0, 3001){
      FOR(j, 1, 3001){
            if (i+j<=F){
              if (S[i]&W[j]){
                if (100*i<=E*j){
                  if (ans <= (double)i/(double)(i+j)){
                    ans = (double)i/(double)(i+j);
                    ans_S = i;
                    ans_W = j+i;
                  }
                }
              }
            }
      }
    }
    cout<<ans_W<<" "<<ans_S<<endl;
  }
};


signed main() {
	CSugarWater solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int prime[1000000]={0};
int main(){
  int i,j,k,flag;
  while(scanf("%d",&i) != EOF){
    flag=0;
    for(j=2;j<=i;j++){
      for(k=2;k*j<55000;k++){
	prime[j*k]=1;
      }
    }
    for(j=i*2;j>1;j--){
      if(j < i && prime[j] == 0){
	printf("%d ",j);
	break;
      }
    }
    for(j=2;j<i*2;j++){
      if(j > i && prime[j] == 0){
	printf("%d\n",j);
	break;
      }
    }
  }
  return (0);
}

Measured memory_bytes: 808
from collections import Counter
n, m = map(int, input().split())
a = Counter(list(map(int, input().split())))

for _ in range(m):
  b, c = map(int, input().split())
  if c in a:
    a[c] += b
  else:
    a[c] = b

a = sorted(a.items(), key=lambda x:x[0])
now = 0
ans = 0 

while n > now:
  tmp = a.pop()
  if now + tmp[1] <= n:
    now += tmp[1]
    ans += tmp[1] * tmp[0]
  else:
    ans += tmp[0] * (n-now)
    now = n

print(ans)

Measured memory_bytes: 42648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		sc.close();
		int xx = x - z;
		int n = xx/(y+z);
	
		System.out.println(n);

	}
	
}


Measured memory_bytes: 23636
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextLong();
		}
		long[] acm = new long[n];
		long[] opt = new long[n];
		acm[0] = a[0];
		opt[0] = (a[0] > 0 ? a[0] : 0);
		for (int i = 1; i < n; ++i) {
			acm[i] = acm[i - 1] + a[i];
			opt[i] = opt[i - 1] + (a[i] > 0 ? a[i] : 0);
		}
		long ans = 0;
		for (int i = 0; i + k - 1 < n; ++i) {
			// [0,i)[i,i+k)[i+k,n)
			long sub = opt[n - 1] - (opt[i + k - 1] - (i > 0 ? opt[i - 1] : 0));
			ans = Math.max(ans, sub);
			ans = Math.max(ans, sub + acm[i + k - 1] - (i > 0 ? acm[i - 1] : 0));
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 35656
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <deque>

using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef deque<pair<ll,ll>> dep;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+1000;
const int mod=1e9+7;
ll infi=1e18+100;

//x=10111;
//x<<2 = 1011100 (右シフト),x>>2 = 101 (左シフト)
//(x>>2)&1 = 101 & 001 = 1
//iビット目は、(x>>i) & 1 でわかる(x>>i)%2 でもよい

int H,W;
char a;
map<char,int>mp;
string alpha="abcdefghijklmnopqrstuvwxyz";


int main(){
	cin>>H>>W;
	rep(i,H) rep(j,W){
		cin>>a;
		mp[a]++;
	}
	bool f=true;
	if((H%2)==0&&(W%2)==0){
		Rep(i,alpha.size()){
			if(mp[alpha[i]]%4!=0){
				f=false;
				break;
			}
		}
	}
	else if((H%2)==0||(W%2)==0){
		int cnt=0;
		Rep(i,alpha.size()){
			if((mp[alpha[i]]%4)==2){
				cnt++;
			}
			if(mp[alpha[i]]%2==1){
				f=false;
				break;
			}
		}
		if(H%2==0){
			if(cnt>(H/2)) f=false;
		}
		else{
			if(cnt>(W/2)) f=false;
		}
	}
	else{
		int cnt1=0;
		int cnt2=0;
		int cnt3=0;
		Rep(i,alpha.size()){
			if((mp[alpha[i]]%4)==1){
				cnt1++;
			}
			else if((mp[alpha[i]]%4)==2){
				cnt2++;
			}
			else if((mp[alpha[i]]%4)==3){
				cnt3++;
			}
		}
		if((cnt1+cnt3)>=2) f=false;
		else if((cnt2+cnt3)>((H+W-1)/2)){
			f=false;
		}
	}
	if(f) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	return 0;
}

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

int main(){
  string s;
  cin>>s;
  int n=s.size(),ans=0;
  rep(i,n){
    if(s[i]!=s[n-1-i])ans++;
  }
  cout<<ans/2<<endl;
}

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

int main(){
  int N, L;
  cin >>N>>L;
  
  int ans = 0;
  repeat(i,N){
    ans += L+i-1;
  }
  
  if(L>0){
    ans = ans - L;
  }else if((L+N-1)<0){
    ans = ans - (L+N-1); 
  }else{
    ans = ans;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
while True:
  n = int(input())
  if not n:
    break
  ss = [s for s in input()[::-1]]
  for i in range(n):
    new = []
    app = new.append
    last = ss.pop()
    count = 1
    while ss:
      a = ss.pop()
      if a == last:
        count += 1
      else:
        app(str(count))
        app(last)
        last = a
        count = 1
    app(str(count))
    app(last)
    new = "".join(new)
    ss = [s for s in new[::-1]]
#    print("".join(new))
  print("".join(new))


Measured memory_bytes: 7568
from itertools import accumulate
from collections import Counter
n, k, *a = map(int, open(0).read().split())
a = [x % k - 1 for x in a]
a = [0] + [x % k for x in accumulate(a)]
d = Counter()
ans = 0
for l, r in zip([k] * min(k, n + 1) + a, a):
	d[l] -= 1
	ans += d[r]
	d[r] += 1
print(ans)


Measured memory_bytes: 36804
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<ll> vll;
typedef std::vector<vll> vvll;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n;
  scan(n);
  vvll ab(n, vll(2));
  scan(ab);
  vll s(n);
  ll sum_b = 0;
  rep (i, n) {
    s[i] = ab[i][0] + ab[i][1];
    sum_b += ab[i][1];
  }
  sort(all(s));
  reverse(all(s));
  ll ans = -sum_b;
  for (int i = 0; i < n; i += 2) {
    ans += s[i];
  }
  print(ans);

  return 0;
}


Measured memory_bytes: 6528
N, M = map(int, input().split())

edges = [[] for _ in range(N)]
for _ in range(M):
	a, b = map(int, input().split())
	a -= 1
	b -= 1
	edges[a].append(b)
	edges[b].append(a)

from collections import deque

d_list = [N + 1] * N
queue = deque()
queue.append(0)
d_list[0] = 0
while len(queue) > 0:
	cur = queue.popleft()
	d = d_list[cur] + 1
	for n in edges[cur]:
		d2 = d_list[n]
		if d2 > d:
			d_list[n] = d
			queue.append(n)

d_pair_list = [(d, i) for i, d in enumerate(d_list)]

def check():
	result = [None] * N
	result[0] = -1
	for d, cur in d_pair_list:
		for n in edges[cur]:
			if d_list[n] == d - 1:
				result[cur] = n
				break
		if result[cur] == None:
			return None
	return result

result = check()
if result != None:
	print("Yes")
	for i in range(1, N):
		print(result[i] + 1)
else:
	print("No")


Measured memory_bytes: 45188
S = gets.strip.split('').map(&:to_i)
K = gets.to_i

if S.slice(0..[K-1,S.size-1].min).all?{|n| n == 1}

    puts 1
    

else

    puts S[(0..S.size-1).bsearch{|x| S[x] != 1}]

end




Measured memory_bytes: 1788
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin, (v).end);


typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int N;

    //入力
    cin >> N;


    for(int i=9; i>0; i--){
        if(N%i == 0)    {N/=i; break;}
    }
    //cout << N << " ";
    for(int i=1; i<10; i++){
        if(i == N)            {cout << "Yes" << endl; return 0;}
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    if (a <= 5) {
        cout << 0 << endl;
    } else if (a <= 12) {
        cout << b / 2 << endl;
    } else {
        cout << b << endl;
    }
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}


fn main(){
    let s = read_as_string().chars().collect::<Vec<char>>();
    let k = read_as_vec::<usize>()[0];

    for i in 0..s.len(){
        if i == k-1{
            println!("{}", s[i]);
            return;
        }
        if s[i] != '1'{
            println!("{}", s[i]);
            return;
        }
    }
}


Measured memory_bytes: 4352
N = int( input() )
A = [ list( map(int, input().split()) ) for _ in range(N-1)]
# C[] = A[][0], S[] = A[][1], F[] = A[][2] 

def arrivalTime( time, loc ):
    if loc == N-1: return time
    if time <= A[loc][1]:
        return arrivalTime( A[loc][1]+A[loc][0], loc+1 )
    else:
        n = (time - A[loc][1] + (A[loc][2] - 1) ) // A[loc][2]
        return arrivalTime( A[loc][1]+A[loc][0] + n*A[loc][2], loc+1 )

for i in range(N-1):
    print( arrivalTime( A[i][1], i ) )
print( 0 )

Measured memory_bytes: 3700
from fractions import gcd
A, B, C, D = map(int, input().split())
l = (C*D)//gcd(C,D)
a = B - (B//C + B//D - B//l)
b = (A-1) - ((A-1)//C + (A-1)//D - (A-1)//l)
print(a-b)

Measured memory_bytes: 5048
n = int(input())
n1 = 0
n2 = 0
n4 = 0
for a in map(int,input().split()):
  if a%4 == 0:
    n4 += 1
  elif a%2 == 0:
    n2 += 1
  else:
    n1 += 1
if n1 <= n4:
  print('Yes')
elif n1 == n4+1 and n2 == 0:
  print('Yes')
else:
  print('No') 

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			var a = cin.ArrayInt(n);

			for (int i = 0; i < n; i++) {
				if (a[i] % 2 == 1) {
					continue;
				}

				if (a[i] % 3 != 0 && a[i] % 5 != 0) {
					Console.WriteLine("DENIED");
					return;
				}
			}

			Console.WriteLine("APPROVED");
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 13140
#include<stdio.h>
int main(void)
{
    int a, b, c, i = 0;
    scanf("%d %d %d", &a, &b, &c);
    while(a <= b)
    {
        if(c % a == 0)
        {
            i++;
        }
        a++;
    }
    printf("%d\n", i);
    return 0;
}


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

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

Measured memory_bytes: 3596
n=int(input())
llist=list(map(int,input().split()))
llist.sort()

counter=0
for i in range(2,n):
	now=i+1
	tmpcounter=0
	for j in range(1,i):
		while now <= n:
			if llist[j-1] + llist[i-1] > llist[now-1]:
				tmpcounter += 1
				now += 1
			else:
				break
		counter += tmpcounter

print(counter)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(x) (x).begin (),(x).end()
#define pb push_back
#define mp make_pair
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<pii>
#define mi map<ll,ll>
#define endl "\n"
#define si set<ll>
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define M 1000000007LL
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
void solve()
{
    ll n; cin>>n;
    ll sum=0;
    rep(i,1,n)
    {
        rep(j,1,n)
        {
            rep(k,1,n)
            {
                ll t = gcd(j,k);
                t = gcd(t,i);
                sum += t;
                //cout<<i<<j<<k<<" "<<sum<<" "<<t<<" ";
            }
        }
    }
    cout<<sum;

}

int main()
{
    SPEED;
    ll t = 1;

   // cin>>t;

    while(t--) solve();

   return 0;
}


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

using namespace std;

int main() {
    vector<int> v(5);
    for (int i = 0; i < 5; i++) {
        cin >> v[i];
    }
    int m = 100000000;
    do {
        int sum = 0;
        for (int i = 0; i < 4; i++) {
            sum += 10 * ((v[i] + 9) / 10);
        }
        sum += v[4];
        m = min(m, sum);
    } while (next_permutation(v.begin(), v.end()));
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
void _OUT() {}; template<class H, class... T> void _OUT(H &h, T &... t) { cout<<' '<<h; _OUT(t...); };
template<class H, class... T> void _P(H &h, T &... t) { cout<<h; _OUT(t...); };
#define _PN(...) _P(__VA_ARGS__); cout << endl;
#define EXEC(...) void exec() { (__VA_ARGS__ - 1) ? multi() : solve(0); }

void exec();
void solve(int t);
void multi() { int TT; cin>>TT; REP1(t,TT) solve(t); }
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    exec();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,M;
vector<int> A(SIZE);

void solve(int _t) {
    cin>>N;
    int ans = -1;
    int cur = 0;
    REP(i,5e6) {
        int cnt = 0;
        REP(j,10) {
            if (cur%10==7) break;
            cur += N;
            cnt++;
        }
        cur /= 10;
        if (!cur) {
            ans = i+1;
            break;
        }
    }
    _PN(ans);
}
EXEC(1)



Measured memory_bytes: 4968
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}
	
	public void solve(Scanner sc) {
		int n = Integer.parseInt(sc.next());
		
		int answer = 0;
		for(int i=0; i<n; i++) {
			int ai = Integer.parseInt(sc.next());
			while(ai % 2 == 0) {
				ai /= 2;
				answer++;
			}
		}
		System.out.println(answer);
	}
}


Measured memory_bytes: 31940
#include <iostream>
#include <vector>

using namespace std;
static const int INF = 1e9;
typedef unsigned long long ull;

int g[] = {2, 3, 5, 10, 12, 15};
int p[] = {380, 550, 850, 1520, 1870, 2244};

void solve()
{
	int dp[51];
	for (int i = 0; i < 51; ++i)
	{
		dp[i] = INF;
	}
	dp[0] = 0;
	for (int i = 0; i < 6; ++i)
	{
		for (int j = 0; j < 51; ++j)
		{
			if (j + g[i] < 51 && dp[j + g[i]] > dp[j] + p[i])
			{
				dp[j + g[i]] = dp[j] + p[i];
			}
		}
	}
	int gram;
	while (cin >> gram, gram)
	{
		cout << dp[gram / 100] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1164
/*
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  MainWindow w;
  w.show();

  return a.exec();
}
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


int main(){
    ll n,a,b;
    scanf("%lld %lld %lld",&n,&a,&b);
    if(b<a)
        swap(a,b);
    ll ans;
    if((b-a)%2==0)
        ans = (b-a)/2;
    if((b-a)%2==1)
        ans = (b-a)/2+min(a-1,n-b) +1;
    printf("%lld\n",ans);
    return 0;
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long uLL;
typedef long double ldb;
typedef pair<int,int> pii;

string s;
char O[3];

void f(int i, int sum)
{
    if(i == 4)
    {
        if(sum == 7)
        {
            cout<<s[0];
            for(int j = 0; j < 3; ++j)
                cout<<O[j]<<s[j+1];
            cout<<"=7\n";
            exit(0);
        }
        return;
    }
    O[i-1] = '-';
    f(i+1, sum+'0'-s[i]);
    O[i-1] = '+';
    f(i+1, sum+s[i]-'0');
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>s;
    f(1, s[0]-'0');
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = int(1e9) + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int sign[] = { 1, -1 };

int main() {
    int N, M;
    cin >> N >> M;
    vll X(N), Y(N), Z(N);
    rep(i, N) cin >> X[i] >> Y[i] >> Z[i];

    vv<ll> dp = vvec(N + 1, M + 2, -LINF);
    ll ans = 0;
    rep(x, 2) rep(y, 2) rep(z, 2) {
        rep(i, N + 1) rep(j, M + 2) dp[i][j] = -LINF;
        dp[0][0] = 0;

        rep(i, N) {
            rep(j, M + 1) {
                dp[i + 1][j + 1] = dp[i][j] + (X[i] * sign[x] + Y[i] * sign[y] + Z[i] * sign[z]);
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            }
        }

        ans = max(ans, dp[N][M]);
    }

    write(ans);
}

Measured memory_bytes: 8192
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	int a, b;
	cin >> a >> b;
	cout << (a + b + 1) / 2 << endl;
	
	
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int y;
string x;
int main()
{
    cin>>x;
    for(int i=0; i<x.size()-1; i++)
        if(x[i]=='C')
            for(int j=i+1; j<x.size(); j++)
                if(x[j]=='F')
                {
                    y=1;
                    cout<<"Yes"<<endl;
                    return 0;
                }
    if(y==0)
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stdio.h>

using namespace std;

#define NUM 50

int w, h;
int c[NUM][NUM];
bool visited[NUM][NUM];
queue<pair<int, int> > Q;

void init(){
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            visited[i][j] = false;
        }
    }
}

bool can_visit(int i, int j){
    if(i < 0 || h <= i || j < 0 || w <= j){
        return false;
    }
    if(visited[i][j] || c[i][j] == 0){
        return false;
    }
    return true;
}

pair<int, int> find_new_place(){
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(can_visit(i, j)){
                return make_pair(i, j);
            }
        }
    }

    return make_pair(-1, -1);
}

bool exec(void){
    scanf("%d %d", &w, &h);
    if(w == 0 && h == 0){
        return false;
    }

    init();

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            scanf("%d", &c[i][j]);
        }
    }

    int count = 0;

    while(true){
        pair<int, int> new_place = find_new_place();
        if(new_place.first == -1){
            break;
        }

        count++;

        Q.push(new_place);
        visited[new_place.first][new_place.second] = true;
        while(!Q.empty()){
            pair<int, int> p = Q.front(); Q.pop();
            int x = p.first;
            int y = p.second;

            vector<pair<int, int> > v;
            v.push_back(make_pair(x, y + 1));
            v.push_back(make_pair(x, y - 1));
            v.push_back(make_pair(x + 1, y + 1));
            v.push_back(make_pair(x + 1, y));
            v.push_back(make_pair(x + 1, y - 1));
            v.push_back(make_pair(x - 1, y + 1));
            v.push_back(make_pair(x - 1, y));
            v.push_back(make_pair(x - 1, y - 1));

            for(auto&& item : v){
                int x_ = item.first;
                int y_ = item.second;
                if(can_visit(x_, y_)){
                    visited[x_][y_] = true;
                    Q.push(make_pair(x_, y_));
                }
            }
        }
    }

    printf("%d\n", count);

    return true;
}

int main(void){
    while(exec()){
        ;
    }
    
    return 0;
}



Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var input1 = int.Parse(Console.ReadLine());

            var lookup = Enumerable.Range(0, input1).Select(_ => Console.ReadLine())
                .ToLookup(x => x);

            var strs = new List<string>
            {
                "AC",
                "WA",
                "TLE",
                "RE"
            };

            foreach (var str in strs)
            {
                Console.WriteLine($"{str} x {lookup[str].LongCount()}");
            }
        }
    }
}


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

class Main{


	public static void main(String[] a){


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



        try {

			String nst = br.readLine();
			int n = Integer.parseInt(nst);

			for (int i = 0; i < n; i++) {
				String str = "";


				String strLn = br.readLine();
				str = strLn.replace("Hoshino", "Hoshina");

				System.out.println(str);

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


	}
}

Measured memory_bytes: 24336
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        char[] c = sc.next().toCharArray();
        int[] w = new int[a+1];
        int[] e = new int[a+1];
        int min = a;
        for(int i=1; i<=a; i++) {
            if(c[i-1] == 'W') {
                w[i]++;
            }
            else {
                e[i]++;
            }
            w[i] += w[i-1];
            e[i] += e[i-1];
        }
        for(int i=1; i<=a; i++) {
            min = Math.min(min, w[i-1]+e[a]-e[i]);
        }
        System.out.println(min);
    }
}

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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

using namespace std;

const int N = 3000;
int n, k, q, a[N], p[N], ans = 1e9 + 100;

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}
set <int> smalls;

int aib[N];

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int lsb(int k){
	return k & -k;
}

int que(int pos) {
	int ans = 0;
	for(; pos > 0; pos-=lsb(pos)) ans += aib[pos];
	return ans;
}

int query(int left, int right) {
	if(left <= 1) return que(right);
	return que(right) - que(left - 1);
}

void upd(int pos, int val) {
	for(; pos < N; pos += lsb(pos)) 
		aib[pos] += val;
}


bool canTake(int pos) {
	// tre sa vad cmpel mai apropiat nr < pos si cel mai apropiat > pos
	// dbg(pos);
	auto it2 = smalls.upper_bound(pos);
	auto it1 = it2;
	it1--;
	// dbg(*it1);
	// dbg(*it2);
	int nr = (*it2 - *it1 - 1) - query(*it1 + 1, *it2 - 1);
	// dbg(nr);
	if(nr >= k)
		return true;
	return false;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> k >> q;


	for(int i = 1; i <= n; i++) cin >> a[i], p[i] = i;

	sort(p + 1, p + n + 1, cmp);

	// for(int i = 1; i <= n; i++)
	// 	m[a[p[i]]] = i;

	smalls.insert(0);
	smalls.insert(n + 1);
	for(int i = 1; i <= n; i++) {
		int j, sz = 0;
		memset(aib, 0, sizeof aib);

		for(j = i; sz < q && j <= n; j++) {
			if(canTake(p[j])) {
				sz++;
				upd(p[j], 1);
				if(sz == q) break;
			}
		}
		// dbg(i);
		// dbg(j);
		// dbg(sz);
		smalls.insert(p[i]);
		if(sz == q) 
			ans = min(ans, a[p[j]] - a[p[i]]);
		else 
			break;
	}
	cout << ans << '\n';
}	

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

constexpr long long int mod = 1000000007LL;
long long int fib(const int n) {
	if (n <= 0) return 1;
	else {
		long long int a = 1, b = 2;
		for (auto i = 0; i < n; ++i) {
			auto temp = b;
			b = (a + b) % mod;
			a = temp;
		}
		return a;
	}
}
long long int count(const int h, const int w, const int k, std::vector<std::vector<long long int>>& memo) {
	if (h == 0) return (k == 1) ? 1 : 0;
	else if (k > w || k < 1) return 0;
	else if (memo[h][k] >= 0) return memo[h][k];
	else return memo[h][k] = (count(h - 1, w, k - 1, memo) * fib(k - 3) % mod * fib(w - k - 1) + count(h - 1, w, k + 1, memo) * fib(k - 2) % mod * fib(w - k - 2) + count(h - 1, w, k, memo) * fib(k - 2) % mod * fib(w - k - 1)) % mod;
}
int main() {
	int h, w, k; std::cin >> h >> w >> k;
	std::vector<std::vector<long long int>> memo(h + 1, std::vector<long long int>(w + 1, -1));
	std::cout << count(h, w, k, memo) << std::endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int K,X;
	cin>>K>>X;
	if(K*500>=X){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " = " << x << endl
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define infll 1e18
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };



//===========================DEBUG======================//
#define XOX 1
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

//================================================================//



//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=1e5+5;

ll n,m;
vi adj[lmt];
ll h[lmt];

int main(){
    #ifndef ONLINE_JUDGE
    freopen("../../input.txt", "r", stdin);
    freopen("../../output.txt", "w", stdout);
	#endif
    fast

    cin>>n>>m;
    loop1(i,n) cin>>h[i];

    ll a,b;
    while(m--){
    	cin>>a>>b;
    	adj[a].pb(b);
    	adj[b].pb(a);
    }
    ll cnt=n;
    loop1(i,n){
    	ll val = h[i];
    	for(ll ch: adj[i]){
    		if(h[ch]>=val){cnt--; debug(i,ch); break;}
    	}
    }
    pt(cnt);
}


/*



*/





Measured memory_bytes: 9540
def sumitb19_d():
    _ = int(input().strip())  # 文字列Sの長さ
    S = str(input().strip())  # 半角数字0-9
    ans = 0

    # 3桁すべて 000 -> 999 を調べる、文字列S内にその順で出現するか
    for i in range(10):
        d1 = S.find(str(i), 0)  # 引数2は開始位置
        if d1 == -1: continue
        for j in range(10):
            d2 = S.find(str(j), d1+1)
            if d2 == -1: continue
            for k in range(10):
                d3 = S.find(str(k), d2+1)
                if d3 > -1: ans += 1

    print(ans)

sumitb19_d()

Measured memory_bytes: 3064
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d;p=100;
     cin>>a>>b;
     if(b==100){
        if(a==0){
            cout<<101<<endl;
        }
        else if(a==1){
            cout<<10100<<endl;
        }
        else{
            cout<<1010000<<endl;
        }
     }
     else{
     for(i=0;i<a;i++){
        b*=100;
     }

     cout<<b<<endl;
}


     return EXIT_SUCCESS;
}



Measured memory_bytes: 3548
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m;
    cin>>n>>m;
    ll ans = n*(n-1)/2;
    ans += (m*(m-1))/2;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm> 
#include <cmath>
#include <map>
#include <queue>
#include <utility>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pii> edge;

int n;
LL T = 0, A = 0;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		LL t, a;
		cin >> t >> a;
		LL ct = t, ca = a;
		LL cnt = max((T + t - 1) / t, (A + a - 1) / a);
		T = (i == 0 ? t : t * cnt); 
		A = (i == 0 ? a : a * cnt);
	}
	cout << T + A << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  ll d;
  cin>>d;
  ll c[26];
  for (ll i = 0; i < 26; ++i)
  {
    cin>>c[i];
  }
  vector<vector<ll>> s(d,vector<ll>(26));
  for (ll i = 0; i < d; ++i)
  {
    for (ll j = 0; j < 26; ++j)
    {
      cin>>s[i][j];
    }
  }
  ll t;
  ll ans=0;
  vector<ll> last(26,-1);
  for (ll i = 0; i < d; ++i)
  {
    cin>>t;
    t--;
    ans+=s[i][t];
    last[t]=i;
    for (ll j = 0; j < 26; ++j)
    {
      ans-=c[j]*(i-last[j]);
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3688
#include <iostream>

using namespace std;

int main() {
    int x;
    cin >> x;
    int ans = 1;
    for (int i=2; i<=x; i++) {
        int t = i*i;
        while(t <= x) {
            ans = max(ans, t);
            t *= i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256