akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  1000LL
#define tmod            998244353
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<ll> &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n);

int main()
{
fast;
ll q=1,t;
//cin >> q;
t = q;
while(q--)
{

    ll h,n,m,k,i,j,l,r,c=0,b,a,g,counter=0,u,v,d,e,w,p,x,y,z,fl=1;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
    cin >> n  ;
    string s;
    cin >> s;
    ll ans = 0;
    char c1 = s[0];
    for(i=0;i<n;i++)
    {
        ans += 1;
        c1 = s[i];
        while(s[i]==c1) i++;
        i--;
    }
    cout << ans ;
}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}

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

}
ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
    int n,h[101];
    int i,j,k;
    int sa[101],b[101];
    int flg;
     
    scanf("%d",&n);
    while(n!=0){
        for(i=0;i<n+1;i++){
            scanf("%d",&h[i]);
        }
        for(i=0;i<n+1;i++){
            k=0;
            for(j=0;j<n+1;j++){
                if(i!=j){
                    b[k]=h[j];
                    k++;
                }
            }
            for(j=0;j<n-1;j++){
                sa[j]=b[j+1]-b[j];
            }
            flg=0;
            for(j=0;j<n-2;j++){
                if(sa[j]!=sa[j+1]){
                    flg=1;
                }
            }
            if(flg==0){
                printf("%d\n",h[i]);
                break;
            }
        }   
        scanf("%d",&n);
    }
    return 0;
}

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

int n;
ll x = 1, y = 1, z = 2, m;

int main() {
	cin >> n;
	for (int i = 0, t, a, c; i < n; ++i) {
		cin >> t >> a;
		c = t + a;
		m = max((x + t - 1) / t * c, (y + a - 1) / a * c);
		z = (m + c - 1) / c * c;
		x = z / c * t;
		y = z / c * a;
	}
	cout << z << endl;
}


Measured memory_bytes: 3592
use std::vec::Vec;
use std::collections::HashMap;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let a: Vec<i64> = read_vec();
    let mut acc = HashMap::<i64, i64>::new();
    let mut ans = 0;
    for i in 0..n {
      let b =  (i as i64 + 1) + a[i];
      let c = - a[i] + (i as i64 + 1);
      if let Some(x) = acc.get(&c) {
        ans += x;
      }
     if let Some(x) = acc.get_mut(&b) {
       *x += 1;
     } else {
       acc.insert(b, 1);
     }
    }
    //println!("{:?}", acc);
    println!("{}", ans);
}


Measured memory_bytes: 12320
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b >> k;
  ll sousa = min(a, k);
  a -= sousa;
  k -= sousa;
  while (1) {
    if (k == 0 || (a == 0 && b == 0)) break;
    if (a == 0) {
      b -= k;
      break;
    } else if (b == 0) {
      a -= k;
      break;
    } else if (a >= 1)
      a--;
    else if (b >= 1)
      b--;
    k--;
  }
  a = max(a, 0LL);
  b = max(b, 0LL);
  cout << a << " " << b << "\n";
  return 0;
}

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

using namespace std;

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

#define int ll

int d;
int c[26];
int s[365][26];
int t[365];

int last[26];

main(){
	cin >> d;
	for(int i=0;i<26;i++) cin >> c[i];
	for(int i=0;i<d;i++){
		for(int j=0;j<26;j++){
			cin >> s[i][j];
		}
	}
	for(int i=0;i<d;i++){
		cin >> t[i];
		t[i]--;
	}


	int ans = 0;
	for(int i=0;i<d;i++){
		int day = i+1;
		ans += s[i][t[i]];
		last[t[i]] = day;
		for(int j=0;j<26;j++){
			ans -= c[j] * (day-last[j]);
		}
		printf("%lld\n",ans);
	}
	

	return 0;
}


Measured memory_bytes: 3720
#!/usr/bin/env python
# coding: utf-8

# In[20]:


from collections import deque


# In[26]:


s = input()


# In[28]:


S = [x for x in s]
ans = 0
l = 0
r = len(S)-1
while l<r:
    if S[l] == S[r]:
        l += 1
        r -= 1
    else:
        if S[l] == "x":
            l += 1
            ans += 1
        elif S[r] == "x":
            r -= 1
            ans += 1
        else:
            ans = -1
            break
print(ans)


# In[ ]:






Measured memory_bytes: 10184
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 N;
  cin >> N;
  string s;
  cin >> s;
  vector<i64> vec;
  for(auto c: s) vec.push_back((i64)(c - 'A'));
  string t = "";
  for(auto i: vec) t.push_back((char)('A' + (i + N) % 26));
  cout << t << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

  for (int i = 0; i < k; i++)
  {
    if (c <= b)
    {
      c = c * 2;
    }
    else if (b <= a)
    {
      b = b * 2;
    }
  }

  if (a < b && b < c)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int N;
	vec(A);
	cin >> N;
	fx(N) {
		vecp(A);
	}
	fx(N) {
		if (A[x]%2==0) {
			if (A[x]%3!=0&&A[x]%5!=0) {
				ce("DENIED");
				return 0;
			}
		}
	}
	ce("APPROVED");

    return 0;
}



Measured memory_bytes: 256
//競技プログラミング　テンプレ
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cstdlib> //abs() これは整数のみ

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)

const int max_v = 300;
const int INF = 1000000;



int main() {
	int n, ans=0;
	cin >> n;

    ans = 48 - n;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    string S, T;
    ll Q;
    ll a, b, c, d;
    cin >> S >> T;
    cin >> Q;
    ll L, M;
    L = S.length();
    M = T.length();
    vector<ll> U(L+1), V(M+1);
    U[0] = 0;
    V[0] = 0;

    for (int i = 1; i < L+1; i++) {
        if(S[i-1] == 'A'){
            U[i] = U[i-1] + 1;
        }
        else{
            U[i] = U[i-1] + 2;
        }        
    }
    for (int i = 1; i < M+1; i++) {
        if(T[i-1] == 'A'){
            V[i] = V[i-1] + 1;
        }
        else{
            V[i] = V[i-1] + 2;
        }        
    }

    for (int i = 0; i < Q; i++) {
        cin >> a >> b >> c >> d;
        if((U[b] - U[a-1])%3 == (V[d] - V[c-1])%3){
            YES();
        }
        else{
            NO();
        }
    }


}   

Measured memory_bytes: 5088
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
int p(int A,int B){
  if(!B)return 1;
  if(B%2)return p(A,B-1)*A%mod;
  int C=p(A,B/2);
  return C*C%mod;
}
signed main(){
  int N;
  cin>>N;
  vector<int> D(N);
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>D[i];
    if((i==0 && D[i]!=0) || (i!=0 && D[i]==0)){
      puts("0");
      return 0;
    }
    A[D[i]]++;
  }
  int n=-1;
  for(int i=1;i<N;i++){
    if(A[i]==0)n=i;
    else if(n!=-1){
      puts("0");
      return 0;
    }
  }
  int ans=1;
  for(int i=1;i<n;i++)
    ans=ans*p(A[i-1],A[i])%mod;
  cout<<ans<<endl;
}

Measured memory_bytes: 4828
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	int n, k;
	cin >> n >> k;
	int a = 1;
	for (int i = 0; i < n; i++) {
		a = min(a * 2, a + k);
	}
	cout << a << endl;
}


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

int main(){
  string hash(20, '#');
  int a[4][3][10] = {};
  int n;
  cin >> n;
  while(n--){
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    a[b - 1][f - 1][r - 1] += v;
  }
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 10; k++){
        cout << " " << a[i][j][k];
      }
      cout << endl;
    }
    if(i != 3)cout << hash << endl;
  }
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    ll x;
    cin >> x;
    ll t = x / 11;
    ll ans = 2*t;
    if (x % 11 > 6) ans += 2;
    else if (x % 11 > 0) ans++;
    cout << ans << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3668
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        long N = S.length();
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        for (int i=0;i<N;i++) {
            int k = (int)S.charAt(i);
            if (map.containsKey(k)) map.put(k, map.get(k)+1);
            else map.put(k, 1);
        }
        ArrayList<Integer> val = new ArrayList<Integer>(map.values());

        long ans = 1+N*(N-1)/2;
        for (Integer v : val) ans-=(long)v*(v-1)/2;
        System.out.println(ans);
    }
}

Measured memory_bytes: 30676
#include <stdio.h>

#define N 200000

int main() {
	int n, i, max, min;
	int R[N];

	scanf("%d", &n);

	scanf("%d", &R[0]);

	min = R[0];
	max = -1e9;

	for (i = 1; i < n; i++) {
		scanf("%d", &R[i]);
		if (max < R[i] - min) max = R[i] - min;
		if (R[i] < min) min = R[i];
	}

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

	return 0;
}

Measured memory_bytes: 1376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS; ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MX  3002
#define FF freopen("input.in","r",stdin); freopen("output.txt","w",stdout);
int n,m;
double dp[MX][MX];
double a[MX];
double f(int i,int cnt)
{
    if(i==n)
    {
        if(cnt>n/2)
            return 1;
        else
            return 0;
    }
    if(dp[i][cnt]!=-1.0)return dp[i][cnt];
    return dp[i][cnt]=f(i+1,cnt+1)*a[i]+f(i+1,cnt)*(1-a[i]);
}
int main()
{
    //FF;
    IOS;
    cin>>n;
    //double x=-1.5;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    for(int i=0;i<=3000;i++)
        for(int j=0;j<=3000;j++)
            dp[i][j]=-1;
    double z=f(0,0);
    printf("%.10f",z);

}



Measured memory_bytes: 70912
#include<stdio.h>
int main(void){
    int L,A,B,C,D;
    int i;
    scanf("%d %d %d %d %d",&L,&A,&B,&C,&D);
    for(i=L;A>0||B>0;i--){
        A-=C;
        B-=D;
    }
    printf("%d\n",i);
    return 0;
}

Measured memory_bytes: 596
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		int a = inint();
		if (a%2 == 0) {
			out.println((a/2) * (a/2));
		}
		else {
			out.println((a/2) * (a/2+1));
		}
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}
	
	public int inint() {
		return in.nextInt();
	}
	
	public String instr() {
		return in.next();
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}
	
	public char[] incharar() {
		return in.next().toCharArray();
	}
	
}

Measured memory_bytes: 21716
#include<iostream>
#include<cmath>
using namespace std;
long long a,b,c,ans;
const long long mod=1e9+7;
long long jc(long long a)
{
	long long res=1;
	for (long long i=1;i<=a;i++)
	{
		res=res*i%mod;
	}
	return res;
}
int main()
{
	cin>>a>>b;
	c=abs(a-b);
	if (c>1)
	{
		cout<<0<<endl;
		return 0;
	}
	ans=jc(a)*jc(b)%mod;
	if (c==0) ans=(ans+ans)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

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

	y /= 1000;

	int n_man   = n;
	int n_gosen = 0;
	int n_sen   = 0;

	int val = n * 10;

	int diff = (val - y);

	while (diff >= 0) {
		while (diff % 9 != 0) {
			diff -= 5;
			n_gosen++;
		}
		n_sen = diff / 9;

		n_man = n - (n_gosen + n_sen);
		if (n_man < 0 || n_gosen < 0 || n_sen < 0) {
			diff -= 5;
		}
		else {
			break;
		}
	}

	if (diff < 0) {
		cout << "-1 -1 -1" << endl;
	}
	else {
		cout << n_man << " " << n_gosen << " " << n_sen << endl;
	}

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int A,B;
  string S;
  cin>>A>>B>>S;
  int a,i;
  int c;
  if(S[A]=='-')
  {
    for(i=0;i<A;i++)
    {
      if('0'<=S[i] && S[i]<='9')
      {

      }else{
        c=c+1;
      }
    }
    for(a=A+1;a<A+B;a++)
    {
      if('0'<=S[a] && S[a]<='9')
      {

      }else{
        c=c+1;
      }
    }
  }else{
    c=c+1;
  }
  if(c>=1)
  {
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


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

using namespace std;
int n;
const int maxn=25;
int a[maxn],b[maxn],c[maxn];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&b[i]);
    for(int i=1;i<n;i++)
        scanf("%d",&c[i]);
    int ans=0;
    ans=b[a[1]];
    for(int i=2;i<=n;i++)
        ans=ans+b[a[i]]+(((a[i]-1)==a[i-1])?c[a[i-1]]:0);
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main(){
	long long int x;
	cin>>x;
	long long int sum;
	sum = (x/500)*1000;
	x -= (x/500)*500;
	sum += (x/5)*5;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9+7;

int main(void){
  int n;
  string now;
  char last;
  set<string> used;
  cin >> n;
  cin >> now;
  last = now.back();
  used.insert(now);
  for(int i = 0;i < n-1;++i){
    cin >> now;
    if(now[0] != last || used.find(now) != used.end()){
      cout << "No" << endl;
      return 0;
    }
    last = now.back();
    used.insert(now);
  }
  cout << "Yes" << endl;
  return 0;
}



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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	int N, H, W;
	cin >> N >> H >> W;

	cout << (N - H + 1) * (N - W + 1) << endl;



	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

N,M,P = map(int,input().split())
edges = []
L = [[] for i in range(N)]
utov = [[] for i in range(N)]
vtou = [[] for i in range(N)]

for i in range(M) :
    u,v,cost = map(int,input().split())
    u -= 1
    v -= 1
    cost -= P
    cost *= -1
    edges.append([u,v,cost])
    utov[u].append(v)
    vtou[v].append(u)

reachableFromS = [False]*N
reachableFromG = [False]*N

def dfs(u) :
    if reachableFromS[u] :
        return
    reachableFromS[u] = True
    for v in utov[u] :
        dfs(v)

def dfs2(v) :
    if reachableFromG[v] :
        return
    reachableFromG[v] = True
    for u in vtou[v] :
        dfs2(u)

dfs(0)
dfs2(N-1)

OK = [reachableFromS[i] * reachableFromG[i] for i in range(N)]

dist = [float("inf")]*N
dist[0] = 0

ans = 0
step = 0
update = True

while update :
    update = False
    for i in range(M) :
        u,v,cost = edges[i]
        if OK[u] * OK[v] == 0 :
            continue
        if dist[v] > dist[u] + cost :
            dist[v] = dist[u] + cost
            update = True
    
    step += 1
    if step > N :
        ans = -1
        break

if ans != -1 :
    ans = max(0, dist[N-1] * (-1))
print(ans)


Measured memory_bytes: 65240
/*
 * Author: Anmol Choudhary
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<"["<<#x<<"="<<x<<"] , ["<<#y<<"="<<y<<"]"<<"\n"
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
void solve()
{
    ll mx=1e9;
    ll n,k,s;
    cin>>n>>k>>s;
    rep0(i,k) cout<<s<<" ";
    repp(i,k,n) cout<<(mx-s+1)<<" ";
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 1280
n, k = map(int, input().split())
s = input()
u = s + s[::-1]
t = min(u[i:i + n] for i in range(n + 1))
i, h = 0, t[0]
for i in range(n):
    if t[i] != h:
        break
j = i
for _ in range(k - 1):
    j <<= 1
    if j >= n:
        print(h * n)
        break
else:
    print(h * j + t[i:i + n - j])


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

int main() {
  int N, s1, s2, s3, s4;
  cin >> N;

  s1 = N / 1000 ;
  s2 = N % 1000 / 100 ;
  s3 = N % 1000 % 100 / 10 ;
  s4 = N % 1000 % 100 % 10 ;
  
  if (s1 == s2) {
   
    if (s2 == s3) {
    cout << "Yes" << endl;
    }
    
    else {
    cout << "No" << endl;
    }      
  }
  
  else if (s2 == s3) {
    
    if (s3 == s4){
    cout << "Yes" << endl;
    }
    
    else {
    cout << "No" << endl;
    }
  }
  
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 998244353
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
int n,m;
int c[17];
int x[20020];
int dp[20020][256];
//map<tuple<int,int,int>,int>M;

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    cin>>n>>m;
    while(n&&m){
        memset(x,0,sizeof(x));
        memset(c,0,sizeof(c));
        memset(dp,0,sizeof(dp));
        for(int i=1;i<=m;i++)cin>>c[i];
        for(int i=0;i<n;i++)cin>>x[i];
        for(int i=0;i<20020;i++)for(int j=0;j<256;j++)dp[i][j]=IINF;
        dp[0][128]=0;

        
        for(int i=0;i<n;i++){
            for(int j=0;j<=255;j++){
                if(dp[i][j]==IINF)continue;
                for(int k=1;k<=m;k++){
                    int y=j+c[k];
                    if(y>255)y=255;
                    else if(y<0)y=0;
                    int tmp=(x[i]-y)*(x[i]-y);
                    chmin(dp[i+1][y],dp[i][j]+tmp);
                }
            }
        }

        int ans=IINF;
        for(int j=0;j<=255;j++)chmin(ans,dp[n][j]);

        cout<<ans<<Endl;

        cin>>n>>m;
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





























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

using namespace std;

#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()

const int MX = (int)1e5 + 10;
// const int mod = (int)1e9 + 7;

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

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

    int a, b;
    cin >> a >> b;

    cout << max({a + b, a - b, a * b}) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		ArrayList<Integer> studentX = new ArrayList<>();
		ArrayList<Integer> studentY = new ArrayList<>();
		ArrayList<Integer> checkPointX = new ArrayList<>();
		ArrayList<Integer> checkPointY = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			studentX.add(Integer.parseInt(sc.next()));
			studentY.add(Integer.parseInt(sc.next()));
		}
		for(int i = 0; i < M; i++) {
			checkPointX.add(Integer.parseInt(sc.next()));
			checkPointY.add(Integer.parseInt(sc.next()));
		}
		sc.close();


		for(int i = 0; i < N; i++) {
			int distance = Integer.MAX_VALUE;
			int ans = 0;
			for(int j = 0; j < M; j++) {
				int tmpX = Math.abs(studentX.get(i) - checkPointX.get(j));
				int tmpY = Math.abs(studentY.get(i) - checkPointY.get(j));
				if(distance > tmpX + tmpY) {
					distance = tmpX + tmpY;
					ans = j + 1;
				}else {
					continue;
				}
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 21716
n,m = gets.split.map &:to_i
$node = Array.new(n){ [] }
m.times do
  a,b = gets.split.map(&:to_i).sort
  $node[a-1] << b - 1
  $node[b-1] << a - 1
end

link = Array.new(n){ nil }

def bfs(link)
  q = [0]
  while !q.empty?
    visit = q.shift
    $node[visit].each do |next_node|
      next unless link[next_node].nil?
      link[next_node] = visit
      q.push next_node 
    end
  end
end

bfs(link)
link.shift

if link.any? &:nil?
  puts 'No'
else
  puts 'Yes'
  link.each do |v|
    puts v + 1
  end
end




Measured memory_bytes: 32900
from scipy.sparse import*
(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]
R,C=[],[]
r=range(2501)
for u,v,a,b in t[:m]:
 for i in r:k=(i+a)*51;R+=k+u,k+v;C+=i*51+v,i*51+u;D+=b,b
for i,(c,d)in enumerate(t[m:],1):
 for j in r:R+=j*51+i,;C+=(j+c)*51+i,;D+=d,
d=csgraph.dijkstra(csr_matrix((D,(R,C)),[8**6]*2),1,min(2500,s)*51+1)
for i in range(2,n+1):print(int(min(d[i::51])))

Measured memory_bytes: 123800
abcd = input()
a, b, c, d = int(abcd[0]), int(abcd[1]), int(abcd[2]), int(abcd[3])
ptn = []
for i in range(8):
    state = [0] * 3
    for j in range(3):
        state[j] = (i >> j) & 1
    ptn.append(state)

for op in ptn:
    val = a
    if op[0] == 0:
        val += b
        c1 = '+'
    else:
        val -= b
        c1 = '-'
    if op[1] == 0:
        val += c
        c2 = '+'
    else:
        val -= c
        c2 = '-'
    if op[2] == 0:
        val += d
        c3 = '+'
    else:
        val -= d
        c3 = '-'
    if val == 7:
        print(str(a) + c1 + str(b) + c2 + str(c) + c3 + str(d) + '=7')
        exit()

Measured memory_bytes: 3064
import bisect

n = int(input())
D = list(map(int, input().split()))
if D[0] != 0:
  print(0)
else:
  c = 1
  temp = 1
  e = 1
  D.sort()
  m = D[-1]
  if n > 1 and D[1] == 0:
    print(0)
    exit()
  else:
    for i in range(1, m+1):
      a = bisect.bisect_right(D, i)
      d = a - temp
      temp = a
      if d == 0 and i>0:
        print(0)
        exit()
      else:
        c *= e**d
        c %= 998244353
        e = d
    print(c)

Measured memory_bytes: 13812
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
int a[10];
int main(){	
	a[1]=read();a[2]=read();a[3]=read();
	sort(a+1,a+4);
	if(a[1]==a[2] && a[2]==a[3]){puts("No");return 0;}
	if(a[1]==a[2] || a[2]==a[3]){puts("Yes");return 0;}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

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

    int n;
    cin >> n;

    ll s = 0;
    int p[60] = {};

    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;

        ll t = 1;
        for (int k = 0; k < 60; k++) {
            int x = (a & t) ? i - p[k]++ : p[k];
            s += t % P * x % P;
            t <<= 1;
        }
    }

    s %= P;
    if (s < 0) s += P;

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
h, n = map(int, input().split())
xs = [0] * n
for i in range(n):
    xs[i] = list(map(int, input().split()))

dp = [10 ** 9] * (h + 1)
dp[0] = 0
for i in range(h):
    for j in range(n):
        x = min(i + xs[j][0], h)
        dp[x] = min(dp[x], dp[i] + xs[j][1])
print(dp[h])


Measured memory_bytes: 68756
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <vector>
using namespace std;
typedef unsigned long long ll;
static inline ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b);}
static inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
    int A, B; cin >> A >> B;
    unsigned long long int ans = lcm(A, B);
    cout << ans << endl;
}


Measured memory_bytes: 256
import math
def calc(now,points,length,M,ans):
  if len(points)==0:
    #print(length).
    ans.append(length)
    return 0
  for i in range(len(points)):
    #print(points,points[:i]+points[i+1:])
    tmp=length + math.sqrt( ((now[0]-M[points[i]][0])**2) + ((now[1]-M[points[i]][1])**2) )
    #print(tmp)
    #return length + calc(M[points[i]],points[:i]+points[i+1:],tmp,M)
    calc(M[points[i]],points[:i]+points[i+1:],tmp,M,ans)
n=int(input())
M=[]
for i in range(n):
  M.append(list(map(int,input().split())))
ans=[]
points=[]
num=1
for i in range(n):
  points.append(i)
  num=num*(i+1)
for i in range(n):
  #print(i,points[:i]+points[i+1:])
  #ans.append(calc(M[i],points[:i]+points[i+1:],0.0,M))
  calc(M[i],points[:i]+points[i+1:],0.0,M,ans)
#print(ans)
print(sum(ans)/num)

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

using namespace std;

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

    int ans = 1;
    for (int p = 2; p * p <= n; ++p) {
        int b = 1;
        while (pow(p, b) <= n) b++;
        ans = fmax(ans, pow(p, b - 1));
    }

    cout << ans << endl;
    return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    ll s;
    cin >> n >> k;
    s=k;
    for(int i=0;i<n-1;i++) {
        s*=k-1;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,n) for(ll i=0;i<n;i++)
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

int main(){
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
    ll x[5],ans;
    for(ll i=0;i<5;i++){
        cin>>x[i];
        if(x[i] == 0){
            ans=i;
        }
    }
    cout<<ans+1<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<ll> A(n);
  ll absmin = 1LL<<60;
  int negcnt = 0;
  ll sum = 0;
  rep(i,n) {
    cin >> A[i];
    chmin(absmin, llabs(A[i]));
    sum += llabs(A[i]);
    if (A[i] < 0) negcnt++;
  }
  if (negcnt % 2 == 0) {
    cout << sum << endl;
  }
  else {
    debug(sum, absmin);
    sum -= 2*absmin;
    cout << sum << endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll m, d;
    cin >> m >> d;

    ll ret = 0;
    FOR(i, 1, m+1) {
        FOR(j, 1, d+1) {
            ll d1 = j%10, d2 = j/10;
            if(d1 >= 2 && d2 >= 2 && d1*d2 == i) {
                // cout << i << " " << j << endl;
                ret++;
            }
        }
    }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
S = list()
minL = 52
res = ''
for i in range(n):
    s = input()
    if len(s) < minL:
        minL = len(s)  
        minS = sorted(s)
    S.append(sorted(s))
    
for i in range(minL):
    ch = minS[i]
    f = 0
    for i in range(len(S)):
        for j in range(len(S[i])):
            if S[i][j] == ch:
                f += 1
                S[i][j] = '1'
                break
            
    if f == len(S):
        res += ch
print(res)
    

    
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int A,B;
    cin>>A>>B;
    int count=0;
    int now=1;
    while(now<B){
        now+=A-1;
        count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

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

int main(){
	ll n,x;cin>>n>>x;
	ll a[n];rep(i,0,n)cin>>a[i];

	ll res = abs(x - a[0]);
	rep(i,0,n)res=gcd(res,abs(x-a[i]));
	cout << res << ednl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define MAX 1000000000
#define INF 1000000
#define M 1000000007
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std; 
int main(){
    fast_io
    ll x,n;
    cin>>x>>n;
    ll a[n];
    map<ll,ll> mp;
    for(ll i = 0;i<n;i++){
      cin>>a[i];
      mp[a[i]]++;
    }
    if(n == 0 || n == 1){
        if(n == 0) cout<<x<<endl;
        else{
          if(a[0] == x){
            cout<<x-1<<endl;
          }
          else{
            cout<<x<<endl;
          }
        }
    }
    else{
    sort(a,a+n);
    ll mini = a[0];
    ll maxi = a[n-1];
    ll ans = 1000000000;
    for(ll i = maxi;i>=mini;i--){
        if(mp[i] == 0){
            ans = min(ans,abs(x-i));
        }
    }
    ll sum = 1000000000;
    for(ll i = mini;i<=maxi;i++){
        if(mp[i] == 0){
            sum = min(sum,abs(x-i));
            if(sum == ans){
              sum = i;
              break;
            }
        }
    }
    if(sum == 1000000000){
      if(x >= a[n-1]){
          if(x == a[n-1]){
            cout<<x+1<<endl;
          }
          else{
            cout<<x<<endl;
          }
      }
      else if(x <= a[0]){
         if(x == a[0]){
             cout<<x-1<<endl;
         } 
         else{
             cout<<x<<endl;     
         }
      }
      else{
          ll r = abs(x-(a[0]-1));
          ll u  = abs(x - (a[n-1]+1));
          if(r <= u){
              cout<<a[0]-1<<endl;
          }
          else{
             cout<<a[n-1]+1<<endl;
          }
      }
    }
    else{
        cout<<sum<<endl;
    }
  }
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
	char name[100];
	int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
	Q[tail]=x;
	tail=(tail+1)%LEN;
}
P dequeue(){
	P x=Q[head];
	head=(head+1)%LEN;
	return x;
}
int min(int a,int b){return a<b ? a:b;}

int main(){
	int elaps=0,c;
	int i,q;
	P u;
	scanf("%d%d",&n,&q);
	for(i=1;i<=n;i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head=1;tail=n+1;
	while(head!=tail){
		u=dequeue();
		c=min(q,u.t);
		u.t-=c;
		elaps+=c;
		if(u.t>0)enqueue(u);
		else{
			printf("%s %d\n",u.name,elaps);
		}
	}
	return 0;
}


Measured memory_bytes: 11872
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True



MOD = 10**9 + 7
class ModInt:

    def __init__(self, x):
        self.x = x.x if isinstance(x, ModInt) else x % MOD

    __str__ = lambda self:str(self.x)
    __repr__ = __str__
    __int__ = lambda self: self.x
    __index__ = __int__

    __add__ = lambda self, other: ModInt(self.x + ModInt(other).x)
    __sub__ = lambda self, other: ModInt(self.x - ModInt(other).x)
    __mul__ = lambda self, other: ModInt(self.x * ModInt(other).x)
    __pow__ = lambda self, other: ModInt(pow(self.x, ModInt(other).x, MOD))
    __mod__ = lambda self, other: ModInt(self.x % ModInt(other).x)
    __truediv__ = lambda self, other: ModInt(self.x * pow(ModInt(other).x, MOD - 2, MOD))
    __floordiv__ = lambda self, other: ModInt(self.x // ModInt(other).x)
    __radd__ = lambda self, other: ModInt(other + self.x)
    __rsub__ = lambda self, other: ModInt(other - self.x)
    __rpow__ = lambda self, other: ModInt(pow(other, self.x, MOD))
    __rmod__ = lambda self, other: ModInt(other % self.x)
    __rmul__ = lambda self, other: ModInt(other * self.x)
    __rtruediv__ = lambda self, other: ModInt(other * pow(self.x, MOD - 2, MOD))
    __rfloordiv__ = lambda self, other: ModInt(other // self.x)

    __lt__ = lambda self, other: self.x < ModInt(other).x
    __gt__ = lambda self, other: self.x > ModInt(other).x
    __le__ = lambda self, other: self.x <= ModInt(other).x
    __ge__ = lambda self, other: self.x >= ModInt(other).x
    __eq__ = lambda self, other: self.x == ModInt(other).x
    __ne__ = lambda self, other: self.x != ModInt(other).x


def main():
    S = input()
    N = len(S)-1
    dp = [[0] * 13  for _   in range(N)]
    dp[0] = [0 for _ in range(13)]
    
    if S[0] == '?':
        for i in range(10):
            dp[0][i] = 1
    else:
        dp[0][int(S[0])] = 1

    for i in range(1,N):
        if S[i] == '?':
            R = range(10)
        else:
            R = [int(S[i])]

        for j in range(13):
            for k in R:
                dp[i][(j * 10 + k) % 13 ] = (dp[i][(j * 10 + k) % 13 ] + dp[i-1][j]) 
        for j in range(13):
            dp[i][j] %= MOD
    
    print(dp[len(S)-2][5])









    pass
if __name__ == '__main__':
    main()

Measured memory_bytes: 61276
#include <iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<set>
typedef long long int ll;
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b){
        if(b==c){
            cout << 1 << endl;
        }else{
            cout << 2 << endl;
        }
    }else{
        if(b==c){
            cout << 2 << endl;
        }else if(a==c){
            cout << 2 << endl;
        }else{
            cout << 3 << endl;
        }
    }
    
    
    
    return 0;
}


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

int main(){
	set<string> s;
	int N;
	string S;

	cin >> N >> S;

	int cnt=0;

	for(int i=0; i<1000; i++){
	  vector<int> c = { i/100, (i/10)%10, i%10 };
	  int f=0;
	  for(int j=0; j<N; j++){
	  	if(S[j] == ('0'+c[f])) f++;
	  	if(f==3)break;
	  }
	  if(f==3)cnt++;
	}


	cout << cnt << endl;

}

Measured memory_bytes: 256