akhauriyash/Code-Regression huggingface dataset:
if __name__ == '__main__':
    m = [input() for _ in range(3)]
    n = input()
    a = [int(input()) for _ in range(int(n))]
    c =[]
    for i in m:
        b = [int(j) for j in i.split()]
        c.append(b)

    for n,i in enumerate(c):
        for m,j in enumerate(i):
            if j in a:
                c[n][m] = -1
                
    re = []
    for i in range(3):
        tmp = []
        tmp2 = []
        for j in range(3):
            tmp.append([i,j])
            tmp2.append([j,i])
        re.append(tmp)
        re.append(tmp2)
    re.append([[0,2],[1,1],[2,0]])
    re.append([[0,0],[1,1],[2,2]])

    f = 0
    for i in re:
        flg =[]
        for n,j in enumerate(i):
            if c[j[0]][j[1]] == -1:
                flg.append(1)
            else:
                flg.append(0)
        if flg == [1,1,1]:
            f = 1
    
    if f == 1:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
  int n;
  int score[2]={0,0};
  int i,j,first=0;
  char taro[100],hanako[100];
  
  scanf("%d",&n);
  for(j=0;j<n;j++)
    {
      for(i=0;;i++)
    {
      scanf("%c",&taro[i]);
      if(first==0)
        {
          i--;
          first++;
        }
      if(taro[i]==' ') break;
    }
      for(i=0;;i++)
    {
      scanf("%c",&hanako[i]);
      if(hanako[i]=='\n') break;
    }
      for(i=0;;i++)
    {
      if((taro[i]==' ')&&(hanako[i]=='\n'))
        {
          score[0]+=1;
          score[1]+=1;
          break;
        }
      if((taro[i]==' ')&&(hanako[i]!='\n'))
        {
          score[1]+=3;
          break;
        }
      if((taro[i]!=' ')&&(hanako[i]=='\n'))
        {
          score[0]+=3;
          break;
        }
      if(taro[i]>hanako[i])
        {
          score[0]+=3;
          break;
        }
      if(taro[i]<hanako[i])
        {
          score[1]+=3;
          break;
        }
    }
    }
  printf("%d %d\n",score[0],score[1]);
  return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int a, b, h, m;
  cin >> a >> b >> h >> m;

  double sho = h * 30 + 0.5 * m;
  double lon = 6 * m;
  double kakudo = sho - lon;

  double ans = a * a + b * b - 2 * a * b * cos(M_PI / 180 * kakudo);
  cout << fixed << setprecision(12) << sqrt(ans) << endl;
}


Measured memory_bytes: 4124
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        t: f64,
        a: f64,
        h: [f64; n],
    }

    println!("{}", h.iter()
             .map(|x| (a - (t - x * 0.006)).abs())
             .enumerate()
             .fold((0usize, std::f64::MAX), |(mi, m), (xi, x)|
                   if m > x {
                       (xi, x)
                   } else {
                       (mi, m)
                   })
             .0

             + 1
             );
}


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

int main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  ll p[5];
  vector<ll> m(5);
  for(int i = 0; i < 5; i++){
    cin >> p[i];
    m[i] = (N + p[i] - 1) / p[i];
  }
  ll g = m[0];
  int idx = 0;
  for(int i = 0; i < 5; i++){
    if(g <= m[i]){
      g = m[i];
    }
  }
  cout << g + 4 << "\n";
  return 0;
}

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


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

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

int main(){
  ll n,m;
  cin >> n >> m;
  vector<PII> load;
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--,b--;
    load.push_back(make_pair(a,b));
  }
  UnionFind uf(n);
  VLL rootNum(n,1);

  ll current = (n-1)*(n)/2;
  VLL ans;
  ans.push_back(current);

  for(int i = m-1; i >= 0; i--){
    int a =load[i].first;
    int b =load[i].second;
    if(uf.issame(a, b)){
      ans.push_back(current);
      continue;
    }
    int anum = rootNum[uf.root(a)];
    int bnum = rootNum[uf.root(b)];
    uf.merge(a, b);


    rootNum[uf.root(a)] = anum+bnum;

    //debug
    // rep(i,n) cout << rootNum[i] << " ";
    // cout << endl;

    current -= anum * bnum;
    ans.push_back(current);
  }

  //cout << "ans size = " << ans.size() << endl;
  for(int i = ans.size()-2; i >= 0; i--){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4596
// #include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
    if (a > 0) cout << "Positive";
    else if (a == 0 || (a < 0 && b > 0)) cout << "Zero";
    else if ((abs(b) - abs(a)) % 2 != 0) cout << "Positive";
    else cout<<"Negative";
	return 0;
}


Measured memory_bytes: 256
def main():
    s = input()
    total = 0
    for i in range(len(s)):
        total += int(s[i])

    if int(s) % total == 0:
        print("Yes")
    else:
        print("No")


def main2():
    n = int(input())
    total = 0
    tmp = n
    while tmp > 0:
        total += (tmp % 10)
        tmp = tmp // 10

    if n % total == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main2()


Measured memory_bytes: 3060
#include <stdio.h>

#define MAX 100001
#define max(a,b) ((a) < (b) ? (b) : (a))

int par[MAX],sib[MAX],deg[MAX];
int height[MAX],dep[MAX];

void init(int);
int depth(int,int);

int main(){
  int n,i,id,l,r;

  scanf("%d" ,&n);
  init(n);

  for(i = 0 ; i < n ; i++){
    scanf("%d%d%d" ,&id ,&l ,&r);

    if(l != -1){
      par[l] = id;
      deg[id]++;
    }
    if(r != -1){
      par[r] = id;
      deg[id]++;
    }
if(l != -1 && r != -1){
  sib[l] = r;
  sib[r] = l;
 }
}

for(i = 0 ; i < n ; i++){
  dep[i] = depth(i,0);
 }

for(i = 0 ; i < n ; i++){
  printf("node %d: parent = %d, sibling = %d, "
         ,i, par[i], sib[i]);

  printf("degree = %d, depth = %d, height = %d, "
         , deg[i], dep[i], height[i]);

  if(par[i] == -1){
    printf("root\n");
  }else if(deg[i] != 0){
    printf("internal node\n");
  }else{
    printf("leaf\n");
  }
 }

return 0;
}

void init(int n){
  int i;

  for(i = 0 ; i < n ; i++){
    par[i] = sib[i] = -1;
    deg[i] = height[i] = 0;
  }
}

int depth(int x,int dep){
  height[x] = max(height[x],dep);
  if(par[x] == -1){
    return dep;
  }else{
    return depth(par[x],dep+1);
  }
}


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

int main(){
    string S;
    cin >> S;
    int a = stoi(S.substr(0,2));
    int b = stoi(S.substr(2,2));

    string ans;
    /*
    if(a <= 12 && b <= 12 && !(a == 0 && b == 0)) ans = "AMBIGUOUS";
    else if(a != 0 && a <= 12) ans = "MMYY";
    else if(b != 0 && b <= 12) ans = "YYMM";
    else ans = "NA";
    */
    if(a == 0 && b == 0) ans = "NA";
    else if(a == 0 || a > 12){
        if(b <= 12 && b != 0) ans = "YYMM";
        else ans = "NA";
    }
    else if(b == 0 || b > 12){
        if(a <= 12 && a != 0) ans = "MMYY";
        else ans = "NA";
    }
    else ans = "AMBIGUOUS";

    cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (n, k): (usize, usize) = read!(usize, usize);
    let a: Vec<usize> = read![[usize]];

    if k == n {
        println!("1");
        return;
    }

    println!("{}", (((n - 1) as f64) / ((k - 1) as f64)).ceil())

    // 以下 k < n とする

    //    let one_pos = a.iter().position(|&x| x == 1).unwrap();
    //    let mut one_range = (one_pos, one_pos + 1);

    // 1を区間の端に含むような幅kの区間を選んでいけば最小になる
    // ↑ウソ！！！！！！
    //
    //    let mut ans = 0;
    //
    //    while one_range.0 != 0 || one_range.1 != n {
    //        let left_len = match one_range.0.checked_sub(k - 1) {
    //            Some(v) => k,
    //            None => one_range.0 + 1,
    //        };
    //        let right_len = match one_range.1 - 1 + k {
    //            v if v > n => n - (one_range.1 - 1),
    //            _ => k,
    //        };
    //        if left_len >= right_len {
    //            one_range.0 = one_range.0 + 1 - left_len;
    //        } else {
    //            one_range.1 = one_range.1 + right_len - 1;
    //        }
    //        ans += 1;
    //    }
    //    println!("{}", ans)
}


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

int main() {
    int n;
    cin>>n;
    stringstream s;
    s<<n;
    string ss =s.str();
  bool flag =false;
    for(int i=0;i<ss.length();i++)
    {
        if(ss[i]=='7')
        {
          flag = true;
            cout<<"Yes"<<"\n";
            break;
        }  
    }
  if(flag==false)
  {
            cout<<"No"<<"\n";
  }

  
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int N, A, B, C, D;
  string S;
  cin >> N >> A >> B >> C >> D >> S;
  A--, B--, C--, D--;
  auto check = [&](int x, int y) {
    x++, y -= 2;
    for (int i = x; i <= y; i++) {
      if (S.substr(i, 2) == "##") return false;
    }
    return true;
  };
  if (C < D) {
    if (check(A, B) && check(C, D)) yes(); no();
  }
  bool f = false;
  for (int i = B - 1; i <= D - 1; i++) {
    if (S.substr(i, 3) == "...") f = true;
  }
  if (!f) no();
  if (check(A, B) && check(C, D)) yes(); no();
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s; cin >> s;
  map<char, int> mp;
  for(auto c : s) ++mp[c];

  if(mp.find('N') != mp.end()) {
    if(mp.find('S') == mp.end()) {
      cout << "No" << endl;
      return 0;
    }
  }
  if(mp.find('S') != mp.end()) {
    if(mp.find('N') == mp.end()) {
      cout << "No" << endl;
      return 0;
    }
  }
  if(mp.find('E') != mp.end()) {
    if(mp.find('W') == mp.end()) {
      cout << "No" << endl;
      return 0;
    }
  }
  if(mp.find('W') != mp.end()) {
    if(mp.find('E') == mp.end()) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb(x) push_back(x)
#define pi 3.141592653589793238

ll find(vector<ll> &v, ll a, ll b, ll c){
    if(b < a+c) return 1;
    else return 0;
}

void solve(){
    string s; cin >> s;
    ll q; cin >> q;
    stack<string> b;
    queue<string> e;
    ll p = 0;
    while(q--){
        ll x; cin >> x;
        if(x == 1){
            if(p == 0) p = 1;
            else p = 0;
        }
        else{
            ll y; cin >> y;
            string c; cin >> c;
            if(y == 1)
            {
                if(p == 0) b.push(c);
                else e.push(c);
            }
            else{
                if(p == 0) e.push(c);
                else b.push(c);
            }
        }
    }
    string ss;
    while(!b.empty()){
        ss += b.top();
        b.pop();
    }
    ss += s;
    while(!e.empty()){
        ss += e.front();
        e.pop();
    }
    if(p == 1) reverse(ss.begin(), ss.end());
    cout << ss << endl;
}


int main() {
    //int t; cin >> t; while(t--)
    solve();
    
	return 0;
}


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


int main(){
    int N;
    vector <int> d(100000);
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>d.at(i);
    }
    sort(d.begin(),d.end()-100000+N);
    if(N%2!=0){
        cout<<0<<endl;
        return 0;
    }
    cout <<d.at(N/2)-d.at(N/2-1)<<endl;
    return 0;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
#define MAX_N (int)1e5
int N, X;
int x[MAX_N];
vector<int> vec;
int gcd(int x, int y){
 if (x < y) swap(x, y);
 if (x % y) return gcd (y, x%y);
 return y;
}

int main(){
    cin >> N >> X;
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }

    for(int i = 0; i < N; i++){
        vec.push_back(abs(x[i] - X));
    }
    sort(vec.begin(), vec.end());
    unique(vec.begin(), vec.end());
    if(vec.size() == 1){
        cout << vec[0] << endl;
        return 0;
    }
    int ans = gcd(vec[0], vec[1]);
    for(int i = 2; i < vec.size(); i++){
        ans = gcd(ans, vec[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1276
def count_primes(max)
  nums = Array.new(max + 1, 1)
  nums[0] = nums[1] = 0

  (2..Math.sqrt(max)).each do |sieve|
    if nums[sieve] == 1
      (2 * sieve).step(max, sieve).each do |num|
        nums[num] = 0
      end
    end
  end

  nums.select { |num| num == 1 }.size
end

while line = gets
  n = line.chomp.to_i
  puts count_primes(n)
end

Measured memory_bytes: 64892
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.flush();
	
  	int a,b,c;
    cin >> a >> b >> c;
  	
   if(a+b<c)
     cout<<"No";
   else
     cout<<"Yes";
	return 0;
	// BYE BYE
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

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

	cout<<(3*a+p)/2;
}

Measured memory_bytes: 256
n = int(input())
e = [0] * (n+1)

for i in range(2, n + 1):
    for j in range(2, i + 1):
        while i % j == 0:
            e[j] += 1
            i //= j
            
def f(m):
    return len(list(filter(lambda x: x >= m-1, e)))

c1 = f(75)
c2 = f(25) * (f(3) - 1)
c3 = f(15) * (f(5) - 1)
c4 = f(5) * (f(5) - 1) * (f(3) - 2) // 2

print(c1 + c2 + c3 + c4)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

void printArray(vector<int> v){
    rep(i, v.size()){
        if(i) cout << " ";
        cout<< v[i];
    }
    cout << endl;
}

void print2dArray(vector<vector<int> > vv){
    rep(i, vv.size()){
        rep(j, vv[i].size()){
            if(j) cout << " ";
            cout << vv[i][j];
        }
        cout << endl;
    }
}

//--global--//



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

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    int n;
    cin >> n;
    string str, tstr;
    cin >> str >> tstr;

    rep(i, n){
        cout << str[i] << tstr[i];
    }
    cout << endl;
    
    return 0;
}


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

int main(void) {
	int n, m;
	cin >> n >> m;

	int a[100][100] = {{}};
	int b[100] = {};

	for (int i = 0; i < n; i++)
	{
		for (int k = 0; k < m; k++)
		{
			cin >> a[i][k];
		}
	}

	for (int i = 0; i < m; i++)
	{
		cin >> b[i];
	}

	for (int i = 0; i < n; i++)
	{
		int c = 0;
		for (int j = 0; j < m; j++)
		{
			c += a[i][j] * b[j];
		}
		cout << c <<endl;
	}

	return 0;
}


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

int N,M;
int p[100010];
string S[100010];
bool F[100010];
int C[100010];

signed main(){
	cin>>N>>M;
	REP(i,M){
		cin>>p[i]>>S[i];
	}
	REP(i,M){
		int s=p[i]-1;
		if(F[s]==false&&S[i]=="WA"){
			C[s]++;
		}
		if(F[s]==false&&S[i]=="AC"){
			F[s]=true;
		}
	}
	int ans=0,ans2=0;
	REP(i,N){
		if(F[i]==true){
			ans++;
			ans2+=C[i];
		}
	}
	cout<<ans<<" "<<ans2<<endl;
	return 0;
}


Measured memory_bytes: 7296
a,b, c = map(int, input().split())

if a == b:
    if a != c:
        print("Yes")
    else:
        print("No")
elif a == c:
    if a != b:
        print("Yes")
    else:
        print("No")
elif b == c:
    if a != b:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include<cmath>
#include<climits>

using namespace std;
#define lli long long int

int main()
{
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt" , "r" , stdin);
// 	freopen("output.txt" , "w" , stdout);
// #endif
	// int n;
	// cin >> n;
	int a, b, c;
	cin >> a >> b >> c;
	int temp = b;
	b = a;
	a = c;
	c = temp;
	cout << a << " " << b << " " << c << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c;
	int tmp;

	scanf("%d %d %d", &a, &b, &c);

	if (a > b) {
		tmp = a;
		a = b;
		b = tmp;
	}
	if (a > c) {
		tmp = a;
		a = c;
		c = tmp;
	}
	if (b > c) {
		tmp = b;
		b = c;
		c = tmp;
	}

	printf("%d %d %d\n", a, b, c);

	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<cmath> // ルートの使用
//#include<bits/stdc++.h>
using namespace std;

int main(){
    long long n;
    long long max;

    cin >> n; // Nの入力
    for(int i=1; i<=sqrt(n);i++){
        if( n % i == 0){
            max = i+(n/i);
        }
    }
    cout << max-2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll poc(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
bool cmp(ppll a,ppll b){
    return a.first.first+a.first.second<b.first.first+b.first.second;
}
int main(){
    //ios::sync_with_stdio(false);cin.tie(0);
    ll n;scanf("%lld",&n);
    vector<ppll> v;
    rep(i,0,n){
        ll w,s,vv;scanf("%lld %lld %lld",&w,&s,&vv);
        v.push_back({{s,w},vv});
    }
    sort(v.begin(),v.end(),cmp);
    ll dp[20001];
    fill(dp,dp+20001,-inf);
    ll ans=0;
    dp[0]=0;
    rep(i,0,n){
        ll s=v[i].first.first,w=v[i].first.second,co=v[i].second;
        rrep(j,s,0){
            ll ne=j+w;
            Max(dp[ne],dp[j]+co);
            Max(ans,dp[ne]);
        }
    }
    
    printf("%lld",ans);
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#define MAX 10000
#define NIL -1
using namespace std;
struct Node { int p, l, r; };
Node T[MAX];
int n;
void preParse(int u) {
	if (u == NIL)return;
	printf(" %d", u);
	preParse(T[u].l);
	preParse(T[u].r);
}
void inParse(int u) {
	if (u == NIL)return;
	inParse(T[u].l);
	printf(" %d", u);
	inParse(T[u].r);
}
void postParse(int u) {
	if (u == NIL)return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d", u);
}
int main() {
	int i, v, l, r, root;
	cin >> n;
	for (i = 0; i < n; i++)T[i].p = NIL;
	for (i = 0; i < n; i++) {
		cin >> v >> l >> r;
		T[v].l = l;
		T[v].r = r;
		if (l != NIL)T[l].p = v;
		if (r != NIL)T[r].p = v;
	}
	for (i = 0; i < n; i++)if (T[i].p == NIL)root = i;
	puts("Preorder");
	preParse(root);
	puts("");
	puts("Inorder");
	inParse(root);
	puts("");
	puts("Postorder");
	postParse(root);
	puts("");
	return 0;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define Ifor(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dfor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Ifoz(i, a) Ifor(i, 0, a)
#define Dfoz(i, a) Dfor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
template <int MX> struct Sieve {
	bitset<MX + 10> isPrime;
	vector<int> pr;
	Sieve () {
		isPrime.set(); isPrime[0] = isPrime[1] = false;
		for (int i = 4; i <= MX; i += 2) isPrime[i] = false;
		for (int i = 3; i * i <= MX; i += 2) if (isPrime[i])
			for (int j = i * i; j <= MX; j += (i << 1)) isPrime[j] = false;
		for (int i = 0; i <= MX; i++) if (isPrime[i]) pr.push_back(i);
	}
};

Sieve<100000> sieve;
int n, k, s;

int findPrime() {
	Trav(x, sieve.pr) if (s % x != 0) return x;
	return -1;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	cin >> n >> k >> s;
	vi ans(n);
	Ifoz(i, k) ans[i] = s;
	int t = findPrime();
	Ifor(i, k, n) ans[i] = t;
	Ifoz(i, n) cout << ans[i] << ' ';
	cout << '\n';
}



Measured memory_bytes: 1792
using System;
using System.Linq;

namespace abc099_d
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[,] d = new int[x[1], x[1]];
            for (int i = 0; i < x[1]; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < x[1]; j++)
                {
                    d[i, j] = a[j];
                }
            }
            int[,] ban = new int[x[0], x[0]];
            for (int i = 0; i < x[0]; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < x[0]; j++)
                {
                    ban[i, j] = a[j];
                }
            }
            int[,] ret = new int[3, x[1]];
            for (int color = 0; color < x[1]; color++)
            {
                for (int i = 0; i < x[0]; i++)
                {
                    for (int j = 0; j < x[0]; j++)
                    {
                        ret[(i + j) % 3, color] += d[ban[i, j] - 1, color];
                    }
                }
            }
            int aa = int.MaxValue;
            for (int i = 0; i < Math.Pow(x[1], 3); i++)
            {
                int[] color = new int[3];
                for (int j = 0; j < 3; j++) color[j] = (int)(i / Math.Pow(x[1], j)) % x[1];
                if (color[0] == color[1] ||
                    color[1] == color[2] ||
                    color[2] == color[0]) continue;
                int now = 0;
                for (int j = 0; j < 3; j++) now += ret[j, color[j]];
                aa = Math.Min(aa, now);
            }
            Console.WriteLine(aa);
        }
    }
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++){
      cin >> A[i];
    }
    for (int i = 1; i < N; i++){
      for (int j = 0; j < N-1; j++){
        cout << A[j] << " ";
      }
      cout << A[N-1] << endl;
      int v = A[i];
      int j = i - 1;
      while (j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
    }
  for (int j = 0; j < N-1; j++){
        cout << A[j] << " ";
      }
  cout << A[N-1] << endl;
}


Measured memory_bytes: 3112
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

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

  if ((2 <= a) && (a <= 13)) 
  {
    a--;
  }
  else
  {
    a = 13;
  }
  
  if ((2 <= b) && (b <= 13)) 
  {
    b--;
  }
  else
  {
    b = 13;
  }

  if(a == b)
  {
    cout << "Draw" << endl;
  }
  else if(a > b)
  {
    cout << "Alice" << endl;
  }
  else if(b > a)
  {
    cout << "Bob" << endl;
  }
  



  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 256
w, h, n = map(int, input().split())
c = [[0] * w for _ in range(h)]

for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        for i in range(h):
            for j in range(x):
                c[i][j] = 1
    elif a == 2:
        for i in range(h):
            for j in range(x, w):
                c[i][j] = 1
    elif a == 3:
        for i in range(y):
            for j in range(w):
                c[i][j] = 1
    elif a == 4:
        for i in range(y, h):
            for j in range(w):
                c[i][j] = 1

ans = 0
for i in range(h):
    for j in range(w):
        if c[i][j] == 0:
            ans += 1

print(ans)


Measured memory_bytes: 3064
/**/
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compile and get accepted.
 *      ____________
 *     /         __ \
 *    /   __    |  | \
 *   /   |__|   |  |  \
 *  (           |__|   )
 *   \                /
 *    \      ___     /
 *     \____________/
 */
const long long mod = 1000000007;
vector<long long> a;
int N;
long long X;
long long get(long long x){
	long long res = x * X;
	deque<long long> mono;
	int j = 0,i = 0,st = (N - x)%N;
	for(j = N - x;j < N;j++){
		while(!mono.empty() && mono.back() > a[j])
			mono.pop_back();
		mono.push_back(a[j]);
	}
	for(i = 0;i < N;i++){
		while(!mono.empty() && mono.back() > a[i])
			mono.pop_back();
		mono.push_back(a[i]);
		assert(!mono.empty());
		res += mono.front();
		if(!mono.empty() && mono.front() == a[st])
			mono.pop_front();
		st++;
		if(st >= N)
			st -= N;
	}
	return res;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	cin>>N>>X;
	a.resize(N);
	long long res = LLONG_MAX;
	for(int i = 0;i < N;i++)
		cin>>a[i];
	for(int i = 0;i < N;i++)
		res = min(res,get(i));
	cout<<res<<'\n';
	return 0;
}
/**/


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

typedef long long int ll;

using namespace std;

int main(void){

    ll n, m;
    ll ans = 0;

    cin >> n >> m;

    vector<pair<ll, ll>> list(n);

    for(int i = 0;i < n;i++){
        int a,b;
        cin >> a >> b;
        list[i] = make_pair(a,b);
    }

    sort(list.begin(), list.end());

    int i = 0;
    while(m > 0){
        if(list[i].second < m){
            ans += list[i].first * list[i].second;
            m -= list[i].second;
        }else{
            ans += list[i].first * m;
            m = 0;
        }
        i++;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

struct edge {
  int a, b, c;
};

int main() {
  int d, n;
  int t[201];
  int dp[201][201];
  edge e[201];
  cin >> d >> n;

  for(int i=0; i<d; i++) {
    for(int j=0; j<n; j++) {
      dp[i][j] = -1;
    }
  }

  for(int i=0; i<d; i++) {
    cin >> t[i];
  }

  for(int i=0; i<n; i++) {
    cin >> e[i].a >> e[i].b >> e[i].c;
  }

  for(int i=0; i<n; i++) {
    if( e[i].a <= t[0] && t[0] <= e[i].b ) {
      dp[0][i] = 0;
    }
  }

  for(int i=1; i<d; i++) {
    for(int j=0; j<n; j++) {
      if( dp[i-1][j] == -1 ) continue;
      for(int k=0; k<n; k++) {
	if( e[k].a <= t[i] && t[i] <= e[k].b ) {
	  dp[i][k] = max(dp[i][k], dp[i-1][j]+abs(e[j].c - e[k].c));
	}
      }
    }
  }

  int ans = 0;
  for(int i=0; i<n; i++) {
    ans = max(ans, dp[d-1][i]);
  }
 
  cout << ans << endl;
}

Measured memory_bytes: 1320
limit = int(input())
seed = [3,5,7]
set357 = set(seed)
def valid(n):
    x_set = set()
    while(n > 0):
        x_set.add(n % 10)
        n //= 10
    return int(x_set == set357)
def f(current):
    ans = valid(current)
    for s in seed:
        temp = (current * 10) + s
        if temp <= limit:
            ans += f(temp)
    return ans

print(f(0))

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n; cin >> n;
	if (n == 0)cout << 1 << endl;
	else if (n == 1)cout << 2 << endl;
	else if (n == 2)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

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

void solve(long long N, long long A, long long B)
{
    long long ABsum = A + B;
    long long cnt = 0;
    long long res = 0;
    long long Asum = 0;

    cnt = N / ABsum;
    res = N % ABsum;

    Asum = A * cnt;
    if (res > A)
    {
        Asum += A;
    }
    else
    {
        Asum += res;
    }

    cout << Asum << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(N, A, B);
    return 0;
}


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

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;}
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i=0; i<(int)(n); ++i)

const long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 110000; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1920
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N=sc.next();
		char[] s = N.toCharArray();
		int a=s.length;
		
		if(s[a-1]=='2'||s[a-1]=='4'||s[a-1]=='5'||s[a-1]=='7'||s[a-1]=='9') {
			System.out.println("hon");
		}
		else if(s[a-1]=='0'||s[a-1]=='1'||s[a-1]=='6'||s[a-1]=='8') {
			System.out.println("pon");
		}
		else {
			System.out.println("bon");
		}
		
		sc.close();
	}
}


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

int main() {
    int n;
    cin >> n;
    char c;
    vector<bool> v(n);
    for(int i = 0; i < n; i++) {
    	cin >> c;
    	if(c == 'W')
    		v[i] =  1;
    	else
    		v[i] = 0;
    }
    int zero_right = 0, one_left = 0;
    int ans;
    for(int i = 0; i < n; i++) {
    	if(v[i] == 0)
    		zero_right++;
    }
    ans = zero_right;

    for(int i = 0; i < n; i++) {
    	if(v[i] == 0) {
    		zero_right--;
    	}
    	else {
    		one_left++;
    	}
    	ans = min(ans, max(zero_right, one_left));
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iostream>
#include<cstring>
using namespace std;
template<class _T>inline void read(_T &_a)
{
    bool f=0; char _c=getchar(); _a=0;
    while(_c<'0'||_c>'9'){ if(_c=='-') f=1; _c=getchar(); }
    while(_c>='0'&&_c<='9'){ _a=(_a<<3)+(_a<<1)-'0'+_c; _c=getchar(); }
    if(f) _a=-_a;
}

const int MAXQ=52;
struct mission {
    int a,b,c,d;
    inline bool operator < (const mission &_x) const { return b<_x.b; }
    inline bool operator < (const int &_x) const { return b<_x; }
}m[MAXQ];
int n,M,q,ans,seq[11],maxx[11][11],msum[11];
bool vis[11];

void dfs(int id,int val,int cnt)
{
    //printf("dfs %d %d %d\n",id,val,cnt);
    if(msum[n]-msum[id-1]+cnt<=ans) return ;
    //printf("dfs %d %d %d\n",id,val,cnt);
    seq[id]=val;
    for (register int i=lower_bound(m+1,m+q+1,id)-m;i<=q&&m[i].b==id;++i)
    {
        if(val==seq[m[i].a]+m[i].c)
            cnt+=m[i].d;
    }
    if(id==n)
    {
        ans=max(ans,cnt);
        return ;
    }
    for (register int i=val;i<=M;++i)
        dfs(id+1,i,cnt);
}

int main()
{
    read(n);
    read(M);
    read(q);
    for (register int i = 1; i <= q; ++i)
    {
        read(m[i].a);
        read(m[i].b);
        read(m[i].c);
        read(m[i].d);
        maxx[m[i].a][m[i].b]=max(maxx[m[i].a][m[i].b],m[i].d);
    }
    for (register int i=1;i<=n;++i)
    {
        msum[i]=msum[i-1];
        for (register int j=1;j<i;++j)
            msum[i]+=maxx[j][i];
        //printf("msum[%d] = %d\n",i,msum[i]);
    }
    sort(m+1,m+q+1);
    for (register int i=1;i<=M;++i) dfs(1,i,0);
/*
    sort(m + 1, m + q + 1);
    for (register int i = 1; i <= q; ++i)
    {
        if(vis[m[i].a])
        {
            if(vis[m[i].b])
            {
                if(seq[m[i].b] - seq[m[i].a] == m[i].c)
                    ans += m[i].d;
            }
            else
            {
                if(m[i].c + seq[m[i].a] <= M)
                {
                    vis[m[i].b] = true;
                    seq[m[i].b] = m[i].c + seq[m[i].a];
                    ans += m[i].d;
                }
            }
        }
        else if(vis[m[i].b])
        {
            if(seq[m[i].b] - m[i].c <= M)
            {
                vis[m[i].a] = true;
                seq[m[i].a] = seq[m[i].b] - m[i].c;
                ans += m[i].d;
            }
        }
        else
        {
            vis[m[i].a] = true;
            vis[m[i].b] = true;
            seq[m[i].a] = 1;
            seq[m[i].b] = 1 + m[i].c;
            ans+=m[i].d;
        }
    }*/
    printf("%d", ans);
    return 0;
}

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

int main() {
	vector<vector<char>> c;
	c.resize(3);
	for (int i = 0; i < 3; i++) {
		c[i].resize(3);
	}

	for (int j = 0; j < 3; j++) {
		for (int k = 0; k < 3; k++) {
			cin >> c[j][k];
		}
	}

	cout << c[0][0] << c[1][1] << c[2][2] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 


int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int ca, cb;
    ca = c%b ? c/b + 1 : c/b;
    cb = a%d ? a/d + 1 : a/d;
    cout << (ca <= cb ? "Yes": "No") << endl;
    return 0;
}

Measured memory_bytes: 3596