akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using vec = vector<T>;
template<typename T> using prior = priority_queue<T>;;

const ll MOD = 1e9+7;
const ll SPMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;
 
#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define siz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define Unique(v) v.rs(unique(ALL(v))-v.begin())
#define EB emplace_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define __ <<' '<<
#define kiyohime ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

// template
ll POW();
int gcd(int a, int b);
// end of template

#define N 100010

void solve(){
    string s;
    bool flag = true;
    
    cin >> s;
    int n = s.size();
    
    rep(i, n/2)
        if(s[i] != s[n-i-1])
            flag = false;
    
    rep(i, n/4){
        if(s[i] != s[n/2-1-i])
            flag = false;
        if(s[n/2+1+i] != s[n-i-1])
            flag = false;
    }
    
    if(flag) cout << "Yes" << '\n';
    else     cout << "No "  << '\n';
}

int main(){
    kiyohime
    int T = 1;
    
    while(T--){
        solve();
    }
}


// templates

ll POW(ll a, ll b, ll m = MOD){
    ll res = 1;
    while(b){
        if(b&1) res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

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


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

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

int M;
int D[202020];;
ll C[202020];

int LP[10][10];
int NP[10][10];

pair<int,int> nex(int cur,int ne) {
	int cnt=0;
	cur=cur*10+ne;
	while(cur>=10) {
		cnt++;
		cur=cur/10+cur%10;
	}
	return {cnt,cur};
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>M;
	
	FOR(x,10) {
		FOR(y,10) {
			int cur=x;
			int num=0;
			for(i=1;i<=1010;i++) {
				auto p=nex(cur,y);
				num+=p.first;
				cur=p.second;
				if(cur==x) break;
			}
			LP[x][y]=i;
			NP[x][y]=num;
		}
	}
	
	
	int P=0;
	ll R=0;
	FOR(i,M) {
		cin>>x>>C[i];
		
		if(i==0) {
			P=x;
			C[i]--;
		}
		
		
		ll a=C[i]/LP[P][x];
		R+=a*NP[P][x];
		C[i]%=LP[P][x];
		
		FOR(j,C[i]) {
			auto p=nex(P,x);
			R+=p.first;
			P=p.second;
		}
	}
	cout<<R<<endl;
}


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


Measured memory_bytes: 1792
#include <iostream>
   using namespace std; // Your code  #include <iostream>using namespace std;
int dfs(int n, int s, int x){
  int sum=0;
  if(n==0 && s==0)
  return 1;
  if(n>0){
      for(int i=x; i<10; i++){
          if(s-i>=0) sum+=dfs(n-1, s-i, i+1);
      }
  }
  return sum;
}
int main(void){
  int n, s;
  while(cin >> n >> s){
      if(n==0 && s==0)
  break;
      cout << dfs(n, s, 0) << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

    int main(){
      Real a,b;
      cin>>a>>b;
      Real c=a*b;
      string s=c.str();
      s+='.';
      lint i=0;
      while(s[i]!='.'){
          cout<<s[i];
          i++;
      }
      cout<<endl;
        
    }
      

Measured memory_bytes: 3940
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int m = 2000;
		BigInteger dp = BigInteger.ONE;
		for (int i = 0; i < n; i++) {
			dp = dp.or(dp.shiftLeft(a[i]));
		}

		int sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
		}
		int start = (sum + 1) / 2;
		int end = m * m;
		for (int i = start; i <= end; i++) {
			if (dp.testBit(i)) {
				System.out.println(i);
				return;
			}
		}
	}
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  if (n == a.size()) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
  int dice[6],q,ins[2],p0,p1,p2,p3;
  int vector[6][4]={{4,2,1,3},{0,2,5,3},{0,4,5,1},{0,1,5,4},{0,3,5,2},{1,2,4,3}};
  int i,j;
  for(i=0;i<6;i++)
  {
    scanf(" %d",&dice[i]);
  }
  scanf(" %d",&q);
  for(i=0;i<q;i++)
  {
    for(j=0;j<2;j++)
    {
      scanf(" %d",&ins[j]);
    }
    for(j=0;j<6;j++)
    {
      if(dice[j]==ins[0])p0=j;
    }
    for(j=0;j<6;j++)
    {
      if(dice[j]==ins[1])p1=j;
    }
    for(j=0;j<4;j++)
    {
      if(vector[p0][j]==p1)p2=j;
    }
    if(p2==0)printf("%d\n",dice[vector[p0][3]]);
    else printf("%d\n",dice[vector[p0][p2-1]]);
  }
  return 0;
}


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

using namespace std;
const int N = 2e5 + 5;
int sz[N], c[N], lst[N], h[N];
long long ans[N], f[N], val[N], s[N];
vector <int> g[N];

void dfs(int v, int p = 0) {
    int prv = lst[c[v]];
    for (int u : g[v]) if (u != p) lst[c[v]] = u, dfs(u, v), ans[c[v]] += 1ll * sz[v] * sz[u], sz[v] += sz[u];
    lst[c[v]] = prv, sz[v]++;
    if (prv > 1) val[prv] += sz[v];
    else s[c[v]] += sz[v];
    return ;
}
void Solve(int v, int p = 0) {
    int prv = lst[c[v]];
    ans[c[v]] += 1ll * sz[v] * (sz[prv] - sz[v] + 1);
    if (prv > 1) f[c[v]] += 1ll * sz[v] * (val[prv] - sz[v]);
    else f[c[v]] += 1ll * sz[v] * (s[c[v]] - sz[v]);
    for (int u : g[v]) if (u != p) lst[c[v]] = u, Solve(u, v);
    lst[c[v]] = prv;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin >> n;
    for (int i = 1; i <= n; i++) cin >> c[i];
    for (int i = 0; i < n - 1; i++) {
        int u, v; cin >> u >> v;
        g[u].push_back(v), g[v].push_back(u);
    }
    fill(lst, lst + N, 1), dfs(1), fill(lst, lst + N, 1), Solve(1);
    for (int i = 1; i <= n; i++) cout << ans[i] - (f[i]/2) << "\n";


    return 0;
}


Measured memory_bytes: 38748
program b
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: i
    character(2*10**5):: t


    read*, t

    do i=1,len_trim(t)
        if (t(i:i) == '?') t(i:i) = 'D'
    end do

    print'(a)', trim(t)
    
end program b

Measured memory_bytes: 3300
k,n=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
data=[0]*n
for i in range(n-1):
  data[i]=a[i+1]-a[i]
data[n-1]=k+a[0]-a[n-1]
print(sum(data)-max(data))

Measured memory_bytes: 32280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int n,m,s,sum=0;
int main(){
	//scanf("%d",&n);
	string a;
	cin>>a;
	if(a[0]==a[1]&&a[1]==a[2]) puts("No");
	else puts("Yes");
	return 0;
}
/*



*/


Measured memory_bytes: 256
#include<iostream>
#include<limits>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;

const int MAX_N = 2 * 1e5 + 2;

ll A[MAX_N];

template <class T>
class RangeMinimumQuerySegTree {
    private:
        int node_size;
        vector<T> node;
    public:
        RangeMinimumQuerySegTree(int n) {
            node_size = 1;
            while (node_size < n) node_size *= 2;
            node.resize(2 * node_size);
            fill(node.begin(), node.end(), numeric_limits<T>::max());
        }
        void update(int idx, T new_value) {
            int node_idx = idx + node_size - 1;
            node[node_idx] = new_value;
            while (node_idx > 0) {
                node_idx = (node_idx - 1) / 2;
                node[node_idx] = min(node[node_idx * 2 + 1], node[node_idx * 2 + 2]);
            }
        }
        T _get_min(int left, int right, int node_idx, int node_left, int node_right) {
            // interval [node_left, node_right) corresponds to node_idx
            if (node_right <= left || right <= node_left) {
                return numeric_limits<T>::max();
            }
            if (left <= node_left && node_right <= right) {
                return node[node_idx];
            }
            else {
                T left_value = _get_min(left, right, node_idx * 2 + 1, node_left, (node_left + node_right) / 2);
                T right_value = _get_min(left, right, node_idx * 2 + 2, (node_left + node_right) / 2, node_right);
                return min(left_value, right_value);
            }
        }
        T get_min(int left, int right) {
            return _get_min(left, right, 0, 0, node_size);
        }
};

ll ans = 0;
map<ll, ll> get_idx;
RangeMinimumQuerySegTree<ll> RMQ(MAX_N);

void divide_conquer(ll left, ll right) {
    if (left == right) return;
    ll min_a = RMQ.get_min(left, right);
    ll idx = get_idx[min_a];
    ans += (idx - left + 1) * (right - idx) * min_a;
    divide_conquer(left, idx);
    divide_conquer(idx + 1, right);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        get_idx[A[i]] = i;
        RMQ.update(i, A[i]);
    }
    divide_conquer(0, N);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 43392
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================

int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================

	int N;
	cin >> N;
	string S;
	cin >> S;



	ll ans = 0;

	ll r = 0;
	ll b = 0;
	ll g = 0;
	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'R')
		{
			r++;
		}
		else if (S[i] == 'G')
		{
			g++;
		}
		else
		{
			b++;
		}
	}

	ans = r * g * b;

	for (int d = 1; d < N; d++)
	{
		for (int s = 0; s < N; s++)
		{
			ll first = s;
			ll second = s + d;
			ll third = second + d;

			if (third < N)
			{
				if (S[first] != S[second] && S[second] != S[third] && S[first] != S[third])
				{
					ans--;
				}


			}

		}



	}




	cout << ans;












}





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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;

void solve() {
	ll n,a,b,pass=0,o=0;cin>>n>>a>>b;
	string s;cin>>s;
	for(int i=0;i<s.length();i++){
		if(s[i]=='c') {cout<<"No\n";continue;}
		if(s[i]=='a') {if(pass<a+b) {pass++;cout<<"Yes\n";} else cout<<"No\n";}
		else if(s[i]=='b'){
			if(pass<a+b && o<b) {pass++;o++;cout<<"Yes\n";}
			else cout<<"No\n";	
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

	//ll t;cin>>t;while(t--)
	solve();

}


Measured memory_bytes: 848
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author ilyakor
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.nextInt();
      int a = in.nextInt() - 1;
      int b = in.nextInt() - 1;
      if (Math.abs(a - b) % 2 == 1) {
        out.printLine("Borys");
      } else {
        out.printLine("Alice");
      }
    }

  }

  static class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void printLine(Object... objects) {
      print(objects);
      writer.println();
    }

    public void close() {
      writer.close();
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public static boolean isSpace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
      if (count == -1) {
        throw new InputMismatchException();
      }
      try {
        if (cur >= count) {
          cur = 0;
          count = stream.read(buffer);
          if (count <= 0) {
            return -1;
          }
        }
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      return buffer[cur++];
    }

    public int readSkipSpace() {
      int c;
      do {
        c = read();
      } while (isSpace(c));
      return c;
    }

    public int nextInt() {
      int sgn = 1;
      int c = readSkipSpace();
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res = res * 10 + c - '0';
        c = read();
      } while (!isSpace(c));
      res *= sgn;
      return res;
    }

  }
}



Measured memory_bytes: 21460
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};

struct Scanner<R: Read> {
    reader: R,
    buffer: String,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader, buffer: String::new() }
    }

    // fn line(&mut self) -> String {
    //     self.buffer = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
    //         .skip_while(|&c| c == '\n' || c == '\r')
    //         .take_while(|&c| !(c == '\n' || c == '\r'))
    //         .collect::<String>();
    //     self.buffer.clone()
    // }

    fn read_buffer(&mut self) {
        self.buffer = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        self.read_buffer();
        if self.buffer.is_empty() {
            None
        } else {
            self.buffer.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            // writeln!(std::io::stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.read()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item=U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(104_857_600)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}

fn solve() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n = sc.read();
    let a: Vec<u32> = sc.vec(n);
    let mut flg = vec![false; 2001];
    for mask in 0..(1<<n) {
        let sum = (0..n).fold(0, |s, i| {
            if mask >> i & 1 == 1 {
                s + a[i]
            } else {
                s
            }
        }) as usize;
        if sum <= 2000 {
            flg[sum] = true;
        }
    }

    let q = sc.read();
    for _ in 0..q {
        let m: usize = sc.read();
        if flg[m] {
            println!("yes");
        } else {
            println!("no");
        }
    }
}



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

 
int main() {
  int N;
  int dig = 0, sum = 0;
  cin >> N;
  int D = N;

  while(N){
    dig = N % 10;
    sum = sum + dig;
    N = N / 10;
  }
  if (D%sum == 0){
  	cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
}


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

int main() {
	int A,B,C,D;
	cin >> A >> B >> C>> D;
	int X = (A+D-1) / D;
	int Y = (C+B-1) / B;
	cout << (X>=Y?"Yes":"No") << endl;
}

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

template<class T>
inline set<T> divisorsList(T n) {
    set<T> div;
    for (T i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            div.insert(i);
            if (i * i != n)
                div.insert(n / i);
        }
    }
    return div;
}

template<class T>
inline T cntDigit(T num) {
	T cnt = 0;
	while (num) {
		num /= 10;
		cnt++;
	}
	return cnt;
}

int main(){
    cin.tie(0)->sync_with_stdio(false);

	ll N;
	cin >> N;

	ll res = 0;
	double sqr = sqrt(N);
	if (floor(sqr) == sqr)
		res = cntDigit((ll)sqr);
	else {
		set<ll> d = divisorsList(N);
		ll n = d.size();
		auto itr = d.begin();
		REP(i, n / 2) itr++;
		res = cntDigit(*itr);
	}

	cout << res << '\n';
    return 0;
}


Measured memory_bytes: 3724
n,m=map(int,input().split())
ans=[-1 for _ in range(n)]
flg=True
for i in range(m):
    s,c=map(int,input().split())
    s-=1
    if ans[s]==-1:
        ans[s]=c
    elif ans[s]!=c:
        flg=False
        
if len(ans)>1 and ans[0]==0:
    flg=False
        
for i in range(n):
    if ans[i]==-1:
        if n==1:
            ans[i]=0
        else:
            if i==0:
                ans[i]=1
            else:
                ans[i]=0
                
if flg:
    print(*ans,sep='')
else:
    print(-1)

Measured memory_bytes: 3064
S = input()
T = input()

if T in S:
    print(S.replace('?', 'a'))
    exit()

SL = len(S)
TL = len(T)

proposition = []
for i in range(SL-TL, -1, -1):
    S2 = S[i:i+TL]
    for j in range(TL):
        if S2[j] == T[j] or S2[j] == '?':
            continue
        else:
            break
    else:
        answer = S[:i] + T + S[i+TL:]
        proposition.append(answer.replace('?', 'a'))
if proposition:
    print(sorted(proposition)[0])
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func main() {
	n := oneInt()
	as := scanNums(n)

	ans := calc(as)

	fmt.Println(ans)
}

func calc(as []int) int64 {
	var minusCount int
	for _, ai := range as {
		if ai < 0 {
			minusCount++
		}
	}
	var answer int64
	if minusCount%2 == 0 {
		for _, ai := range as {
			answer += int64(abs(ai))
		}
	} else {
		s := make([]int, 0, len(as))
		for _, ai := range as {
			s = append(s, abs(ai))
		}
		sort.Ints(s)
		answer = int64(s[0] * -1)
		for _, si := range s[1:] {
			answer += int64(abs(si))
		}
	}
	return answer
}

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}

func nextWord(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanNums(n int) (nums []int) {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		s := nextWord(sc)
		num, _ := strconv.Atoi(s)
		nums = append(nums, num)
	}
	return nums
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

int main(){
	fastio;
	string str;
	cin>>str;
	ll n = str.size();
	ll l=0,r=n-1;
	ll ans = 0;
	while(l<=r){
		if(str[l]!=str[r]) ans++;
		l++;r--;
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin>>s;
  int ans=0;
  for (int i=0;i<s.size();i++){
    if(s[i]=='R'){
      ans+=1;
    }
  }
  if (ans==2 & s[1]=='S'){
    cout<<1<<endl;
  }
  else if (ans==2 & s[1]=='R'){
    cout<<2<<endl;
  }
  else{
  cout<<ans<<endl;
  }
  return 0;
} 

Measured memory_bytes: 3584
N = int(input())
a = list(map(int, input().split()))
colors = [0] * 9
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        colors[0] = 1
    elif 400 <= a[i] and a[i] <= 799:
        colors[1] = 1
    elif 800 <= a[i] and a[i] <= 1199:
        colors[2] = 1
    elif 1200 <= a[i] and a[i] <= 1599:
        colors[3] = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        colors[4] = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        colors[5] = 1
    elif 2400 <= a[i] and a[i] <= 2799:
        colors[6] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        colors[7] = 1
    else:
        colors[8] += 1

if sum(colors[0:8]) == 0 and colors[8] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector<pair<ll,ll>> primeFactorDecomp(ll n){
      vector<pair<ll,ll>> ret;
      ll m=n;
      for(ll i=2;i*i<=m;i++){
            if(n%i!=0) continue;
            int cnt=0;
            while(n%i==0){
                  cnt++;
                  n/=i;
            }
            ret.push_back({i,cnt});
      }
      if(n>1){
            ret.push_back({n,1});
      }
      return ret;
}

int main(){
  ll n;
  cin >> n;
  vector<pair<ll,ll>> v=primeFactorDecomp(n);
  ll ans=0;
  rep(i,v.size()){
    ll x=v[i].second;
    ll s=0;
    while(s*(s+1)<=2*x){
      s++;
    }
    s--;
    ans+=s;
  }
  cout << ans << endl;
return 0;}

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

using namespace std;

void Main() {
    string s;
    cin >> s;
    cin >> s;
    cout << "A" << s[0] << "C" << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3584
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

const ll MOD = 1e9+7;

signed main(){
    string s;
    cin>>s;
    
    static int dp[100001][4][4];
    rep(i,100001)rep(j,4)rep(k,4)dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    
    for(int i=1;i<=s.size();i++){
        for(int j=0;j<=3;j++){
            for(int k=0;k<=3;k++){
                dp[i][j][k] = dp[i-1][j][k];
            }
        }

        char ch = s[i-1];
        if(ch=='A'){
            (dp[i][1][0] += dp[i-1][0][0])%=MOD;
        }else if(ch=='B'){
            rep(k,4){
                (dp[i][2][k] += dp[i-1][1][k])%=MOD;
            }
        }else if(ch=='C'){
            rep(k,4){
                (dp[i][3][k] += dp[i-1][2][k])%=MOD;
            }
        }else{
            assert(ch=='?');
            for(int j=1;j<=3;j++){
                for(int k=1;k<=3;k++){
                    (dp[i][j][k] += dp[i-1][j-1][k-1])%=MOD;
                }
            }
        }
    }
    
    int q = 0;
    rep(i,s.size()){
        if(s[i]=='?')q++;
    }
    
    vector<int> three(q+1,0);
    three[0] = 1;
    for(int i=1;i<three.size();i++) (three[i] = 3*three[i-1])%=MOD;
    
    
    int ans = 0;
    rep(k,4){
        if(q-k<0)continue;
        (ans += dp[s.size()][3][k] * three[q-k])%=MOD;
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 13696
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int x;
    
    cin >> x;
    
    if (x == 3 || x == 5 || x == 7){
    
    cout << "YES" << endl;
    
    }else{
    
    cout << "NO" << endl;
    
    }
    
    
    
//////////////////////////////////////////////////////
return 0;}

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

using namespace std;
using ll = long long int;
#define INF 20000000000000000
#define MOD 1000000007

int main(void){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++) cin >> a[i];
  int temp[8] = {0};
  
  int ans = 0;
  int red = 0;
  
  for(int i = 0;i < n;i++){
    temp[a[i]/400] = 1;
    if(a[i] >= 3200) red++;
  }
  
  for(int i = 0;i < 8;i++){
    if(temp[i] == 1) ans++;
  }
  
  cout << (ans == 0 ? 1 : ans) << " " << ans+red << endl;
}

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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int gcd(int a, int b){if (a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}


//素因数分解で出てきた素数を全て挿入するvector
const int MAXN = 1000001;
const int hal = 10001;
int di[MAXN];
int Prime[MAXN];


int main() {
    int N;cin >> N;
    int A[MAXN];
    rep(i,N)cin >> A[i];
    memset(Prime,0,sizeof(Prime));
    for(int i=2;i<MAXN;i++){
        if(Prime[i]==0){
            Prime[i] = i;
            int tmp = i;
            while((tmp+i)<MAXN){
                tmp += i;
                if(Prime[tmp]==0)Prime[tmp] = i;
            }
        }
    }
    Prime[1] = 1;

    memset(di,0,sizeof(di));
    rep(i,N){
        if(Prime[A[i]] != A[i]){
            int tmp = A[i];
            while(tmp>1){
                di[Prime[tmp]]++;
                // cout << tmp <<" " << Prime[tmp]<< endl;
                int pr = Prime[tmp];
                while(tmp%pr==0){
                    tmp /= pr;
                }
            }
        }else{
            di[A[i]]++;
        }
    }
    di[0] = 0;
    di[1] = 0;

    rep(i,MAXN){
        if(di[i]>1){
            int tmp = A[0];
            Rep(i,N-1){
                tmp = gcd(tmp,A[i]);
            }

            if(tmp==1){
                cout << "setwise coprime" << endl;
                return 0;
            }else {
                cout << "not coprime" << endl;
                return 0;
            }
        }
    }

    cout << "pairwise coprime" << endl;

    return 0;
}

Measured memory_bytes: 15288
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define isMonth(x) ( 1 <= x && x <= 12 )

int main(int argc, char const *argv[])
{
	int num, t, b;

	scanf("%d", &num);
	t = num / 100;
	b = num % 100;

	if( isMonth(t) && isMonth(b) )
		puts("AMBIGUOUS");
	else if( isMonth(t) && !isMonth(b) )
		puts("MMYY");
	else if( !isMonth(t) && isMonth(b) )
		puts("YYMM");
	else
		puts("NA");

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

signed main() {
  int n, q, t;
  string name;
  queue<pair<string, int> > Q;
  cin >> n >> q;

  for(int i = 0; i < n; i++) {
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;
  int elaps = 0, a;

  while(!Q.empty()) {
    u = Q.front(); Q.pop();
    a = min(u.second, q);
    u.second -= a;          // 残りの必要時間
    elaps += a;             // 経過時間を加算
    if(u.second > 0) {
      Q.push(u);            // 処理が完了していなければ Queue の後ろに追加
    }  else {
      cout << u.first << " " << elaps << endl;  // 完了していれば名前と経過時間を出力
    }
  }

  return 0;
}



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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  loop {
    Real r; cin >> r;
    if (!cin || r < 0) break;

    string s = "";
    range (i, 7, -1) {
      Real f = pow(2.0, i);
      if (r >= f) {
        r -= f;
        s += "1";
      } else {
        s += "0";
      }
    }
    s += ".";
    range (i, -1, -5) {
      Real f = pow(2.0, i);
      if (r >= f) {
        r -= f;
        s += "1";
      } else {
        s += "0";
      }
    }

    if (r < 1e-11) {
      cout << s << endl;
    } else {
      cout << "NA" << endl;
    }

  }

  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 105;
const int MAX_V = 10005;

int v[MAX_N];
int w[MAX_N];
int dp[MAX_V];

int main()
{
	int n;
	int W;
	cin >> n >> W;
	rep(i,n){
		scanf("%d%d",&v[i],&w[i]);
	}
	int sumv = accumulate(v,v+n,0);
	fill(dp,dp+sumv+1,INF);
	dp[0] = 0;
	rep(i,n){
		for(int j=sumv;j>=v[i];j--){
			dp[j] = min(dp[j],dp[j-v[i]]+w[i]);
		}
	}
	int ans;
	rep(j,sumv+1){
		if(dp[j] <= W){
			ans = j;
		}
	}
	cout << ans <<"\n";
	return 0;
}

Measured memory_bytes: 3244
def tenka17_c():
    N = int(input())
    ans = None
    for x in range(1, 3501):
        for y in range(1, 3501):
            a = N * x * y
            b = 4*x*y - N*y - N*x
            if b < 1: continue
            if a % b == 0:
                ans = (x, y, a//b)
                break
        if ans: break
    print(*ans, sep=' ')

tenka17_c()

Measured memory_bytes: 9084
n = gets.to_i
ts = gets.split.map(&:to_i)
m = gets.to_i

drinks = []
m.times do |i|
  prob_id, t = gets.split.map(&:to_i)
  drinks << [prob_id - 1, t]
end

default_res = ts.inject(:+)

res = default_res
drinks.each do |i|
  prob_id, t = i
  current = default_res - ts[prob_id] + t
  puts current
end


Measured memory_bytes: 1788
#include<stdio.h>
#define MAXN 100500
int N, M;
int f[MAXN], dis[MAXN];
void init()
{
	for (int i = 0; i <= N; i++)
	{
		f[i] = i;
	}
}
int find(int x)
{
	if (f[x] == x)
		return x;
	else
	{
		int r = find(f[x]);
		dis[x] = dis[f[x]] + dis[x];
		return f[x] = r;
	}
}
int find_father(int x,int y,int z)
{
	int fx = find(x);
	int fy = find(y);
	if (fx == fy)
	{
		return z == (dis[y] - dis[x]);
	}
	f[fy] = fx;
	dis[fy] = dis[x] + z - dis[y];
	return 1;
}
int main()
{
	int a = 1;
	scanf("%d %d", &N, &M);
	init();int x, y, z;
	for (int i = 1; i <= M; i++)
	{
		
		scanf("%d %d %d", &x, &y, &z);
		if (a)
			a = find_father(x, y, z);
	}
	if (a)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> d(k);
	for(auto &ref : d){
		cin >> ref;
	}

	while(true){
		string str_n = to_string(n);
		bool find_f = false;
		for(auto i : d){
			if(str_n.find(to_string(i)) != -1){//嫌いな数字が含まれていた場合
				find_f = true;
				break;
			}
		}
		if(!find_f){//嫌いな数字が一つも含まれていなかった場合
			break;//ループを抜けて出力
		}
		n++;
	}
	cout << n;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int, int>P;
typedef pair<int, pair<int, int>>PP;
typedef long long ll;
ll inf = -1;
ll mod = mod = pow(10, 9) + 7;

int main() {
	int n, x;
	cin >> n >> x;
	int d = 0;
	int ans = 1;
	for (int i = 0; i < n; i++) {
		int l; cin >> l;
		d = d + l;
		if (d <= x) {
			ans++;
		}
		else {
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = input()

if len(n) == 1:
  print(n)
  exit()

if all(x == "9" for x in n[1:]):
  ans = n
else:
  ok = False
  ans = ""
  for i, c in enumerate(n):
    x = int(c)
    if x == 9:
      ans += "9"
    else:
      if ok:
        ans += "9"
      else:
        if i == len(n)-1:
          ans = ans[:-1]
          ans += str(int(n[i-1])-1)
          ans += "9"
        else:
          ans += str(x-1)
      ok = True
t = 0
for c in ans:
  x = int(c)
  t += x

print(t)

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

#define int long long

signed main()
{
    int N;
    cin >> N;
    double x[N], y[N];
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }

    vector<int> order(N);
    for (int i = 0; i < N; i++) {
        order[i] = i;
    }

    int num = 0;
    double value = 0.0;
    do {
        for (int i = 1; i < N; i++) {
            double dx = x[order[i]] - x[order[i - 1]];
            double dy = y[order[i]] - y[order[i - 1]];
            double r2 = dx * dx + dy * dy;
            value += sqrt(r2);
        }
        num++;
    } while (next_permutation(order.begin(), order.end()));

    double ans = (value / static_cast<double>(num));
    cout << fixed << setprecision(40) << ans << endl;
}


Measured memory_bytes: 256
// RAKSHIT KADAM
 
//  -- Declare array globally...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// find_by_order returns iterator to  element present at that index...
// order_of_key returns no. of elements having value stricktly less than that given in the order_of_key();
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000003
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 200006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500066;
 void solve()
{ll f=0;
    ll n;cin>>n;
    set<ll>s;
    for(ll i=1;i<10;i++)
        for(ll j=1;j<10;j++)s.insert(i*j);
    if(s.find(n)!=s.end())cout<<"Yes";else cout<<"No";
}
signed main()
{
   Need_for_speed(activated);

//satisfy
//    {
//  solve();
//   }
   
    solve();
    return 0;
}


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

//const int r=1e9+7;
int main(){

float d,t,s;
cin>>d>>t>>s;

float k=d/s;

if(k<=t){
    cout<<"Yes";
}
else{
    cout<<"No";
}

return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include<string>
using namespace std;
int main()
{
	string a;
	cin >> a;
	int res = 0;
	char b[5] = { 'L','R','U','D' };
	for (int i = 0; i < a.size(); i++)
	{
		if (i % 2 == 0 && a[i] == b[0])
			res = 1;
		if (i % 2 == 1 && a[i] == b[1])
			res = 1;
	}
	if (res == 1)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int x,S[1000],top=0;

void push(int x)
{
  S[++top]=x;
}

int pop()
{
  int x=S[top--];
  return x;
}

int main(){
  int i;
  
  while(scanf("%d",&x)!=EOF)
    {
      if(x==0)
	{
	  printf("%d\n",S[top]); 
	  pop();
	}
      else
	{     
	  push(x);
	} 
    }
  
  return 0;
}

Measured memory_bytes: 0
N = int(input())
S = list(input())
sS = set(S)
from itertools import product
sS = product(sS,repeat=3)
c = 0

for i in sS:
	if i[0] in S:
		a = S.index(i[0])
		if i[1] in S[a+1:]:
			b = S[a+1:].index(i[1]) + a + 1
			if i[2] in S[b+1:]:
				c += 1
print(c)

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll H, W;
    cin >> H >> W;
    vector<string> S(H+2);
    S[0] = string(W+2, '#');
    S[H+1] = string(W+2, '#');
    REP(i,1,H+1) {
        string s;
        cin >> s;
        S[i] = "#" + s + "#";
    }

    ll c = 0;
    REP(i,1,H+1) {
        REP(j,1,W+1) {
            if(S[i][j] == '.') ++c;
        }
    }

    queue<pll> Q;
    mat D(H+2, vec(W+2, -1));
    vector<pll> dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    Q.push({1, 1});
    D[1][1] = 1;
    while(!Q.empty()) {
        pll p = Q.front(); Q.pop();
        ll i = p.first, j = p.second;
        FORR(d,dir) {
            ll k = i + d.first, l = j + d.second;
            if(S[k][l] == '.' && D[k][l] == -1) {
                D[k][l] = D[i][j] + 1;
                Q.push({k, l});
            }
        }
    }

    if(D[H][W] == -1) PR(-1);
    else PR(c-D[H][W]);

    return 0;
}

/*



*/

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

int main() {
  vector<int> A(3);
  for(int i=0; i<3; i++) {
      cin >> A.at(i);
  }
  int a = abs(A.at(0) - A.at(1));
  int b = abs(A.at(1) - A.at(2));
  int c = abs(A.at(0) - A.at(2));
  cout << min({a+b,a+c,b+c}) << endl;
}


Measured memory_bytes: 3592
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int a, b;
	cin >> a >> b;
	int ans = (a + b + 2 - 1) / 2;
	cout << ans;
}

Measured memory_bytes: 256
s = input()
sl = list(map(int, [s[0:2],s[2:]]))
f,l = sl[0], sl[1]
if (f ==0 and (l ==0 or l >12)) or (l ==0 and (f==0 or f>12)) :
    print('NA')
elif (f>12 and l<13) or f==0:
    print('YYMM')
elif (f<13 and l>12) or l==0:
    print('MMYY')
elif f < 13 and l <13:
    print('AMBIGUOUS')
else:
  print('NA')

Measured memory_bytes: 3064
import numpy as np
n,m = map(int,input().split())
a_ls,b_ls = [0] * n, [0]*n
for i in range(n):
    a_ls[i], b_ls[i] = map(int,input().split())
arg = list(np.argsort(a_ls))
count = 0
sumprice = 0
t = 0
target = arg[t]
while True:
    b_ls[target] -= 1
    count += 1
    sumprice += a_ls[target]
    if count >= m:
        break
    if b_ls[target] == 0:
        t += 1
        target = arg[t]
        
print(sumprice)

Measured memory_bytes: 24472
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string n;
    cin>>n;
    int sum=0,flag=0,tmp=0;
    for (int j=0;j<n.size();j++) {
        tmp+=n[j]-48;
    }
    for (int i=0;i<n.size();i++) {
        if (i==0) {
            if (n[i]-48!=9) {
                sum+=n[i]-48-1;
                flag=1;
            } else {
                sum+=9;
            }
        } else if (i==n.size()-1) {
            if (flag==0&&n[i]-48!=9) {
                sum--;
                sum+=9;
            } else {
                sum+=9;
            }
        } else {
            if (n[i]!=9) {
                sum+=9;
            }
        }
    }
    cout<<max(tmp,sum)<<endl;
}

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

using namespace std;

int main() {
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
        int n;
        scanf("%d", &n);
        vector<vector<double>> dp(n + 10, vector<double>(n + 10, 0.0));
        vector<double> p(n);
        for (int i = 0; i < n; i++) {
                scanf("%lf", &p[i]);
        }
        dp[0][1] = p[0];
        dp[0][0] = (1.0 - p[0]);
        for (int i = 0; i < n; i++) {
                for (int j = 0; j <= i + 1; j++) {
                        if (dp[i][j] == 0) {
                                continue;
                        }
                        dp[i + 1][j + 1] += dp[i][j] * p[i + 1];
                        dp[i + 1][j] += dp[i][j] * (1.0 - p[i + 1]);
                }
        }
//        for (int i = 0; i < n; i++) {
//                for (int j = 0; j <= i + 1; j++) {
//                        printf("%d %d %.10lf\n", i, j, dp[i][j]);
//                }
//        }
        double tot = 0;
        for (int i = n / 2 + n % 2; i <= n; i++) {
                tot += dp[n - 1][i];
        }
        printf("%.10lf\n", tot);
        return 0;
}


Measured memory_bytes: 71040