akhauriyash/Code-Regression huggingface dataset:
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

extension Int {

    // 約数
    var divisors: [Int] {
        var divisors: [Int] = []

        // √Nまで
        for number in 1...Int(sqrt(Double(self))) {
            if self % number == 0 {
                divisors.append(number)

                // N / aが割り切れる場合、N / aも約数
                if self.isMultiple(of: number), self / number != number {
                    divisors.append(self / number)
                }
            }
        }

        divisors.sort(by: <)

        return divisors
    }
}

func mainD() {
    let N = readInt()
    let numbers = readInts()

    // 各数字があるかないかを表す配列
    var exists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)
    // 重複
    var doubleExists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)

    for number in numbers {
        if exists[number] {
            doubleExists[number] = true
            continue
        }

        exists[number] = true
    }

    var count = 0
    for number in numbers {
        if doubleExists[number] {
            continue
        }

        var answer = true

        // 約数で自分以外
        var divisors = number.divisors
        divisors.removeLast()
//        if divisors.count > 1 {
//            divisors.remove(at: 1)
//        }

        for divisor in divisors {
            if exists[divisor] {
                answer = false
                break
            }
        }

        if answer {
            count += 1
        }
    }

    print(count)
}
mainD()

Measured memory_bytes: 23828
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int A,B,C,X,Y;cin >> A >> B >> C >> X >> Y;
    int ans = 0;
    if(X > 0 && Y > 0){
        int Z = min(X,Y);
        if(A+B > 2*C)ans += 2*C*Z;
        else ans += (A+B)*Z;
        X -= Z;Y -= Z;
    }
    if(X > 0 && Y == 0){
        if(A > 2*C) ans += 2*C*X;
        else ans += A*X;
    }
    if(X == 0 && Y > 0){
        if(B > 2*C) ans += 2*C*Y;
        else ans += B*Y;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}

	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x := getNextInt64(scanner)
	var yen int64
	yen = 100
	y := 0
	for yen < x {
		yen += yen / 100
		y++
	}
	fmt.Fprintln(writer, y)
}


Measured memory_bytes: 1800
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
  ll n;
  cin>>n;
  string s;cin>>s;
  ll t=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='.')continue;
    t*=10;t+=ll(s[i]-'0');
  }
  n*=t;
  cout<<n/100<<"\n";
}

Measured memory_bytes: 3592
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

vector<ll> prime_factors(ll n) {
  vector<ll> factors;
  // print the number of 2s that divide n
  while (n % 2 == 0) {
    factors.push_back(2);
    n = n / 2;
  }

  for (ll i = 3; i * i <= n; i += 2) {
    // while i divides n, print i and divide n
    while (n % i == 0) {
      factors.push_back(i);
      n = n / i;
    }
  }

  // n is a prime number greater than 2
  if (n > 2) factors.push_back(n);

  return factors;
}

int main() {
  ll A, B;
  cin >> A >> B;

  auto Aprime = prime_factors(A);
  auto Bprime = prime_factors(B);
  sort(begin(Aprime), end(Aprime));
  sort(begin(Bprime), end(Bprime));

  vector<ll> primes;

  set_intersection(begin(Aprime), end(Aprime), begin(Bprime), end(Bprime),
                   inserter(primes, end(primes)));
  // ここまでで共通の素因数分解ができている。
  primes.erase(unique(begin(primes), end(primes)), end(primes));

  cout << primes.size() + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <bitset>

using namespace std;

int main() {
  int64_t N;
  cin >> N;
  bitset<1000001> b;

  int64_t d = 1;
  for (int64_t i = 2; i * i <= N; i += d) {
    for (int64_t j = i + i; j * j <= N; j += i) {
      b.set(j);
    }
    d = 2;
  }

  unordered_map<int64_t, int64_t> p;
  int64_t tmp = N;
  int64_t i = 2;
  d = 1;
  while (i * i <= tmp) {
    if (b[i] == 1) {
      i += d;
      d = 2;
      continue;
    }
    if (tmp % i == 0) {
      p.insert(make_pair(i, 1LL));
      tmp /= i;
      while (tmp % i == 0) {
        ++(p[i]);
        tmp /= i;
      }
    }
    i += d;
    d = 2;
  }
  if (1 < tmp) {
    p.insert(make_pair(tmp, 1LL));
  }

  int64_t result = 0;
  for (auto& q : p) {
    i = 1;
    d = 1;
    while (i <= q.second) {
      ++result;
      ++d;
      i += d;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3756
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int K = 10;
ll f[K][K], s[K][K], ss[K]; // i,  - i-cyfr, konczac na k lub zaczynajac

int main() {
	ios_base::sync_with_stdio(false);
	REP(i, K) {
		f[0][i] = 1;
	}
	ss[0] = 9;
	FOR(dl, 1, 9) {
		REP(cyf, K) {
			FOR(roz, -1, 1) {
				int ncyf = cyf + roz;
				if (ncyf < 0 || ncyf >= K) {
					continue;
				}
				f[dl][cyf] += f[dl - 1][ncyf];
			}
			s[dl][cyf] = f[dl][cyf];
			if (cyf > 0) {
				s[dl][cyf] += s[dl][cyf - 1];
				ss[dl] += f[dl][cyf];
			}
			// printf("f[%d][%d] = %lld, %lld\n", dl, cyf, f[dl][cyf], s[dl][cyf]);
		}
	}
	int n;
	cin >> n;
	--n;
	int ileCyf = 0;
	while (n >= ss[ileCyf]) {
		n -= ss[ileCyf];
		++ileCyf;
	}
	// printf("ileCyf: %d, n: %d\n", ileCyf, n);
	int cyf = 1;
	// printf(" dl: %d, start_cyf: %d\n", dl, start_cyf);
	vi res(ileCyf + 1);
	while (n >= f[ileCyf][cyf]) {
		n -= f[ileCyf][cyf];
		++cyf;
	}
	res[0] = cyf;
	FORD(dl, ileCyf, 0) {
		int ncyf = -1;
		FOR(i, -1, 1) {
			ncyf = cyf + i;
			if (ncyf < 0 || ncyf >= K) {
				continue;
			}
			if (f[dl][ncyf] > n) {
				break;
			}
			n -= f[dl][ncyf];
		}
		res[ileCyf - dl] = ncyf;
		cyf = ncyf;
	}
	for (auto cyfr: res) {
		printf("%d", cyfr);
	}
	printf("\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>                 // [PRIMES]               1777 ~2^10.80
using namespace std;                     //                       10333 ~2^13.33
using ll = long long;                    // seq 1 128 | factor   100333 ~2^16.61
using ld = long double;                  //   | grep -v ' .* '  1300111 ~2^20.31
using vl = vector<ll>;                   //                    10300777 ~2^23.30
using vvl = vector<vl>;                  //                   100400999 ~2^26.58
using pll = pair<ll,ll>;                 //                  1300400999 ~2^30.28
using vpll = vector<pll>;                //                 10200500333 ~2^33.25
using vb = vector<bool>;                 //                100200400777 ~2^36.54
using vs = vector<string>;               //               1200300700111 ~2^40.13
const ll oo = 0x3f3f3f3f3f3f3f3fLL;      //              10200300500777 ~2^43.21
const ld eps = 1e-9;                     //             100200300400777 ~2^46.51
#define sz(c) ll((c).size())             //            1200300400600999 ~2^50.09
#define all(c) begin(c),end(c)           //           10200300400600111 ~2^53.18
#define mp make_pair                     //          100200300400600333 ~2^56.48
#define mt make_tuple                    //         1200300400500800999 ~2^60.06
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);

	ll n; cin >> n;
	vvl acts(n+1, vl(3));
	FOR(i,0,n) cin >> acts[i+1][0] >> acts[i+1][1] >> acts[i+1][2];

	vvl dp(n+1, vl(3, 0));
	FOR(i,1,n+1) {
		TR(i);
		vl prev = dp[i-1];
		dp[i][0] = max(prev[1], prev[2]) + acts[i][0];
		dp[i][1] = max(prev[0], prev[2]) + acts[i][1];
		dp[i][2] = max(prev[0], prev[1]) + acts[i][2];
		TR(dp[i][0]);
		TR(dp[i][1]);
		TR(dp[i][2]);
	}

	cout << *max_element(all(dp[n])) << "\n";

	return 0;
}


Measured memory_bytes: 11264
import math

N = int(input())
n = int(math.log10(N))

if n % 2 == 1:
    m = n // 2
    print((100 ** (m + 1) - 1) // 11)
else:
    m = n // 2
    val = (100 ** m - 1) // 11
    print(val + N - 100 ** m + 1)



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

using namespace std;


template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

template< typename T >
struct FordFulkerson {
  struct edge {
    int to;
    T cap;
    int rev;
  };

  vector< vector< edge > > graph;
  vector< int > used;
  const T INF;
  int timestamp;

  FordFulkerson(int n) : INF(numeric_limits< T >::max()), timestamp(0) {
    graph.resize(n);
    used.assign(n, -1);
  }

  void add_edge(int from, int to, T cap) {
    graph[from].emplace_back((edge) {to, cap, (int) graph[to].size()});
    graph[to].emplace_back((edge) {from, 0, (int) graph[from].size() - 1});
  }

  T dfs(int idx, const int t, T flow) {
    if(idx == t) return flow;
    used[idx] = timestamp;
    for(auto &e : graph[idx]) {
      if(e.cap > 0 && used[e.to] != timestamp) {
        T d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  T max_flow(int s, int t) {
    T flow = 0;
    for(T f; (f = dfs(s, t, INF)) > 0; timestamp++) {
      flow += f;
    }
    return flow;
  }
};

int main() {
  int N, M, S, T;
  int A[2000], B[2000], C[2000], D[2000];

  cin >> N >> M >> S >> T;
  --S, --T;
  WeightedGraph< int > g(N), rg(N);
  for(int i = 0; i < M; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    --A[i], --B[i];
    g[A[i]].emplace_back(B[i], C[i]);
    rg[B[i]].emplace_back(A[i], C[i]);
  }
  auto latte = dijkstra(g, S);
  auto malta = dijkstra(rg, T);
  FordFulkerson< int > flow(N);
  for(int i = 0; i < M; i++) {
    if(latte[A[i]] + malta[B[i]] + C[i] == latte[T]) {
      flow.add_edge(A[i], B[i], D[i]);
    }
  }
  cout << flow.max_flow(S, T) << endl;
}


Measured memory_bytes: 3264
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d", &a,&b,&c);
	if (a == b , b==c){
		printf("No\n");
	}

	else if (a < b){
		if (b < c){
			printf("Yes\n");
		}
		else { printf("No\n"); }
	}
	else 	 {
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 2600
"""
https://atcoder.jp/contests/cf17-final/tasks/cf17_final_d

全て置けるかの判定を考える
H+Pで昇順ソート
後ろから見ていって、その時点での座布団がH+P以下なら○　だめならX
を付けてPを引く
を繰り返し、全て○なら全員置ける(丸の数以上の答えであることが確定する)

あとは前から見ていってdp?
dp[i][j] = i人目まで見てj人置いた時の最小の枚数
→H+Pでソートするのが正しいなら絶対おｋなんだが…

"""

N = int(input())

SHP = []

for i in range(N):

    h,p = map(int,input().split())
    SHP.append( (h+p,h,p) )

SHP.sort()

dp = [float("inf")] * (N+1)
dp[0] = 0

for i in range(N):

    s,h,p = SHP[i]

    for j in range(N-1,-1,-1):

        if dp[j] <= h:
            dp[j+1] = min(dp[j+1] , dp[j] + p)

ans = 0
for i in range(N+1):
    if dp[i] != float("inf"):
        ans = i
print (ans)

Measured memory_bytes: 48020
#include<bits/stdc++.h>
#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forf(i,a,b) for(i=a;i<b;i++)
#define forr(i,a,b) for(i=a;i>b;i--)
#define mp make_pair
#define f first
#define s second
#define pb(x) push_back(x)
typedef  long long  int ll;
typedef std::vector<ll> vi;

#define input(vec,a,b) for(ll i =a;i<b;i++) cin>>vec[i]
#define print(vec,a,b) for(ll i=a;i<b;i++) cout<<vec[i]<<" " ;cout<<endl;
#define all(a) a.begin(),a.end()
using namespace std;


void solve(){
        ll i,j , n,w,out;
        cin>>n>>w;
        ll we[n],v[n];
        for(i=0;i<n;i++)
        {
                 cin>>we[i]>>v[i];
        }
        ll mv[n+1][w+1]={0};
        bool p[n+1][w+1]={0};
        
        for(i=0;i<=w;i++)
        {
                 mv[0][i]=0;
                 
        }
        for(i=0;i<=n;i++)
        {
                 mv[i][0]=0;
                 p[i][0]=1;
        }
        
        for(i=1;i<=n;i++)
        {
                 for(j=0;j<we[i-1];j++)
                 {
                          p[i][j]=p[i-1][j];
                          mv[i][j]=mv[i-1][j];
                 }
                 for(j=we[i-1];j<=w;j++)
                 {
                          if(p[i-1][j-we[i-1]])
                          {
                                   mv[i][j]=max(mv[i-1][j],mv[i-1][j-we[i-1]]+v[i-1]);
                                   p[i][j]=1;
                          }
                          else
                          {
                                   mv[i][j]=mv[i-1][j];
                                   p[i][j]=p[i-1][j];
                          }
                 }
        }
        out=0;
        for(i=w;i>=0;i--)
        {
              out=max(out,mv[n][i]);
        }
        cout<<out;
}

int main()
{
      IO;
      ll t=1;
      //cin>>t;


      while(t--)
      {

          solve();
      }
    return 0;
}

Measured memory_bytes: 92160
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

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

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

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

  sort(all(L));

  int ans = 0;
  for(int i = 0; i < N; i++) {
    for(int j = i + 1; j < N; j++) {
      int right = lower_bound(all(L), L[i] + L[j]) - L.begin();
      ans += right - (j + 1);
      // cerr << right - (j + 1) << endl;
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#define pii pair<int, int>
#define piii pair<pii, int>
#define pll pair<long long, long long>
#define ff first
#define ss second

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; cin >> n;
    int A[n], B[n];
    for(int i = 0; i < n; ++i) cin >> A[i];
    for(int i = 0; i < n; ++i) cin >> B[i];

    pii C[n]; for(int i = 0; i < n; ++i) C[i] = {B[i], A[i]};
    sort(C, C + n);
    pii D[n]; for(int i = 0; i < n; ++i) D[i] = {C[i].ss, i};
    sort(D, D + n);

    for(int i = 0; i < n; ++i)
    if(C[i].ff < D[i].ff) {cout << "No"; return 0;}
    for(int i = 1; i < n; ++i)
    if(C[i - 1].ff >= D[i].ff) {cout << "Yes"; return 0;}

    int cnt = 1, pnt = D[0].ss;
    while(pnt) pnt = D[pnt].ss, ++cnt;
    cout << (cnt == n ? "No" : "Yes");
    return 0;
}


Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
ll h;
int main(){
	read(h);
	ll n=log2(h)+1;
	ll r=1,ans=0;
	for(int i=1;i<=n;i++){
		ans+=r;
		r<<=1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
const lli INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1e9 + 7;
const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; 
const int N = 1e6 + 10;
int nums[N];
lli bpow(lli baseee, lli exponenttt) {
	if(exponenttt < 0) return 0;
	lli res = 1;
	baseee %= MOD;
	while (exponenttt > 0) {
		if ((exponenttt & 1) == 1) res = (res*baseee) % MOD;
		baseee = (baseee*baseee) % MOD;
		exponenttt >>= 1;
	}
	return res;
}
lli multInverse(lli a) {//if_mod_is_prime
	return bpow(a, MOD - 2);
}
lli divm(lli a, lli b) {//if_mod_is_prime
	return (a * multInverse(b)) % MOD;
}
lli multm(lli a, lli b) {
	return (a * b) % MOD;
}
lli subm(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli addm(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
int sieve[N];
map<int, int> aa;

void fillSieve(int n) {
	for(int i = 1; i < N; i++) sieve[i] = i;
	for(int i = 1; i <= n; i++) {
		if(nums[i] == nums[i-1]) continue;
		if(sieve[nums[i]] != nums[i]) continue;
		for(int j = 2*nums[i]; j < N; j+=nums[i]) 
			sieve[j] = i;
	}
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> nums[i];
	sort(nums + 1, nums + n + 1);
	for(int i = 1; i <= n; i++) aa[nums[i]]++;
	fillSieve(n);
	
	int ans = 0;
	for(int i = 1; i <= n; i++)
		if(aa[nums[i]] == 1 && sieve[nums[i]] == nums[i]) 
			ans++;
	cout << ans << "\n";
	return 0;
}

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

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

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string s;cin>>s;
  //a:1010...
  //b:0101...
  //の差分
  int a=0,b=0;
  rep(i,s.size()){
    //奇数
    if(i%2==0&&s[i]=='1')b++;
    else if(i%2==0&&s[i]=='0')a++;
    //偶数
    else if(i%2==1&&s[i]=='1')a++;
    else if(i%2==1&&s[i]=='0')b++;
    //cout<<a<<" "<<b<<endl;
  }
  cout<<(a>b?b:a)<<endl;
}

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

int main(){
  int N; cin >> N;
  vector<int> H(N);
  for(int i = 0; i < N; i++){
    cin >> H[i];
  }
  bool ans = true;
  for(int i = 0; i < N - 1; i++){
    if (H[i] < H[i + 1]){
      H[i + 1]--;
    }
    else if(H[i] == H[i + 1]) continue;
    if(H[i] > H[i + 1]){
      ans = false;
      break;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
import math

n,k = map(int, input().split())

def main(i):
  blue = math.factorial(k-1) // (math.factorial(i-1) * math.factorial(k-i))
  red = math.factorial(n-k+1) // (math.factorial(n-k+1-i) * math.factorial(i))
  print((blue*red) % (10**9 + 7))

for i in range(1, k+1):
  if i > n-k+1:
    print('0')
  else:
   main(i)


Measured memory_bytes: 9228
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long


signed main(){

  int n; cin >> n;
  int N = 1 << n;
  vector<int> s(N);
  for(int i = 0; i < N; i++) cin >> s[i];
  sort(s.begin(),s.end());

  multiset<int> st;
  for(int i = 0; i < N-1; i++){
    st.insert(s[i]);
  }

  vector<int> v;
  v.push_back(s[N-1]);
  for(int i = 0; i < n; i++){
    vector<int> next = v;
    for(int j = 0; j < v.size(); j++){
      auto p = st.lower_bound(v[j]);
      if(p == st.begin()){
        cout << "No" << endl;
        return 0;
      }
      p--;
      next.push_back(*p);
      st.erase(p);
    }
    v.swap(next);
    sort(v.rbegin(),v.rend());
  }
  cout << "Yes" << endl;

  return 0;
}


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

using namespace std;

const int INF = 1e9 + 7;

void solve()
{
  string str;
  cin >> str;
  int n = str.size();
  sort(str.begin(), str.end());
  str.erase(unique(str.begin(), str.end()), str.end());
  if (n == str.size()) cout << "yes\n";
  else cout << "no\n";
}

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

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

main() {
    string S,T; cin >> S >> T; bool can =false;
    rep(i,S.size()){
        bool can2=true;
        rep(j,S.size()){
            if(S[(j+i)%S.size()]==T[j]);
            else can2=false;
        }
        if(can2)can = true;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int main() {
	string s;
	cin>>s;
	int e=s.size();
	int ans=0;
	for(int i=0;i<e-1;i++) {
		if(s[i]=='A'&&s[i+1]=='C') {
			cout<<"Yes"<<endl;
			ans++;
			break;
		}
	}
	if(ans==0) {
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
cmds = ['']*n
for i, c in enumerate(t):
    if c == 'r':
        cmd = 'p'
        pt = p
    elif c == 's':
        cmd = 'r'
        pt = r
    elif c == 'p':
        cmd = 's'
        pt = s
    if i-k >= 0 and cmds[i-k] == cmd:
        cmd = ''
        pt = 0
    ans += pt
    cmds[i] = cmd

print(ans)

Measured memory_bytes: 4084
import sys
readline = sys.stdin.readline

N = int(readline())
dp = [[0] * 3 for i in range(N + 1)]

for i in range(N):
  works = list(map(int,readline().split()))
  for j in range(3):
    for k in range(3):
      if j == k:
        continue
      dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + works[k])

print(max(dp[-1]))

Measured memory_bytes: 28692
#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
#include <bitset>
#include <cstdint>
using namespace std;

#ifdef DEBUG
#include <cassert>
#else
#define assert(x)
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
using ll = long long;

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // 浮動小数の表示の精度
    cout << setprecision(15);

    int a, b;
    cin >> a >> b;
    int ans = -1;
    rep(yen, 10000)
    {
        if (yen * 8 / 100 == a && yen * 10 / 100 == b)
        {
            ans = yen;
            break;
        }
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,t,x,y,i,ans=0;
  cin>>n>>t;
  cin>>x;
  for(i=0;i<n-1;i++){
    cin>>y;
	if(y-x>t){
      ans+=t;
    }else{
      ans+=y-x;
    }
    x=y;
  }
  
  cout<<ans+t<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,M,K;
	int ans=-1;
	int i,j;
	
	cin>>N>>M>>K;
	
	for(i=0;i<N+1;i++){
		if(ans!=1){
			for(j=0;j<M+1;j++){
				if(i*j+(N-i)*(M-j)==K){
					cout<<"Yes";
					ans=1;
					break;
				}
			}
		}else{
			break;
		}
	}
	if(ans!=1){
		cout<<"No";
	}
	return 0;
}
			

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


using ull = unsigned long long;
struct stuff{
	int w,v;
	friend decltype(auto)
		operator>>(std::istream&is, stuff&s) {
		return is >> s.w >> s.v;
	}

};
int main() {
	int n, w;
	std::cin >> n >> w;
	std::vector<stuff> vs;
	vs.resize(n);
	
	int vsum{};// <= 10^2 * 10^3
	for (auto&e : vs) {
		std::cin >> e;
		vsum += e.v;
	}

	std::vector<std::vector<ull>> tab;//tab[n][v] = w;
	tab.resize(n+1);
	for (auto&e : tab)
		e.resize(vsum+1, 1'000'000'000'000);

	for (int i{}; i<n; ++i)
		tab[1][vs[i].v]	= static_cast<ull>(vs[i].w);

	/*
	for (const auto&e : tab[1])
		std::cout << " " << e;
	std::cout << "\n";
	*/

	for (int i{1}; i <= n; ++i) {
		for (int j{}; j <= vsum; ++j) {

//			std::cout << "(" << i << ", " << j << ") : "
//				<< tab[i][j] << " >>  ";

			const auto& stuff_i = vs[i - 1];

			if (j >= stuff_i.v)
				tab[i][j] = std::min(
					tab[i - 1][j - stuff_i.v ] + stuff_i.w
					, tab[i - 1][j]);
			else
				tab[i][j] = std::min( tab[i - 1][j]
					, static_cast<ull>(stuff_i.w ) );//?

//			std::cout << tab[i][j] << "\n";
		}
//		std::cout << "\n";

		auto p = [&]() {
			std::cout << i << " ";
			for (const auto&e : tab[i])
				std::cout << " " << e;
			std::cout << "\n";
		};
//		p();
	}

	auto index = 0;
	while (tab[n][index] <= w)
		++index;

	std::cout << index << "\n";
}

Measured memory_bytes: 79488
MOD=10**9+7
N = int(input())
K = len(bin(N)) - 2
DP = [[0]*3 for _ in range(K+1)]
DP[0][0] = 1
for k in range(K):
    if N & (1 << K - k - 1):
        DP[k+1][0] = DP[k][0]
        DP[k+1][1] = (DP[k][0] + DP[k][1]) % MOD
        DP[k+1][2] = (DP[k][1]*2 + DP[k][2]*3) % MOD
    else:
        DP[k+1][0] = (DP[k][0] + DP[k][1]) % MOD
        DP[k+1][1] = DP[k][1]
        DP[k+1][2] = (DP[k][1] + DP[k][2]*3) % MOD
print(sum(DP[-1]) % MOD)

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


void solve(std::string S, std::string T, long long A, long long B, std::string U){
    if (S.compare(U) && T.compare(U)){
        printf("%lld %lld\n",A-1,B-1);
    }else if (S.compare(U) && !T.compare(U)){
        printf("%lld %lld\n",A,B-1);
    }else if (!S.compare(U) && T.compare(U)){
        printf("%lld %lld\n",A-1,B);
    }else{
        printf("%lld %lld\n",A,B);
    }

}

// Generated by 1.1.6 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(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string U;
    std::cin >> U;
    solve(S, T, A, B, U);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

string S, T;
// vector<int> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> S >> T;
  // A.resize(N);
  // for (int i = 0; i < N; i++) {
  //   int tmp;
  //   cin >> tmp;
  //   A[i] = tmp;
  // }

  if (S == T.substr(0, T.size() - 1)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用

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

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

	int h, w;
	cin >> h >> w;
	vector<string> a(h);
	vector<bool> gyo(h,false),ret(w,false);
	rep(i, h)
	{
		cin >> a[i];
        rep(j,w)
        {
            if(a[i][j]=='#')
            {
                gyo[i]=true;
                ret[j]=true;
            }
        }
    }
    
    rep(i,h)
    {
        rep(j,w)
        {
            if(gyo[i] && ret[j])
                cout<<a[i][j];
        }
        if(gyo[i])
        cout<<endl;
    }

	return 0;
}

Measured memory_bytes: 256
#define NAME "a"

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <cctype>
#include <cassert>
#include <memory>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <iterator>

#define pb push_back
#define mp make_pair
#define frs first
#define snd second

using namespace std;

#ifdef WIN32
    #define lld "%I64d"
#else
    #define lld "%lld"
#endif

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 7;
const ll INFLONG = (ll) 1e18 + 7;
const double EPS = 1e-9;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<string> vs;

typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;

template <typename T>
T sqr(T a) {
    return a * a;
}

int main() {
    srand(time(0));

//    freopen(NAME".in", "r", stdin);
  //  freopen(NAME".out", "w", stdout);

    int s, w;
    cin >> s >> w;
    cout << ((w >= s) ? "unsafe" : "safe") << endl;

//    printf("%.3lf\n", (double) clock() / CLOCKS_PER_SEC);
    return 0;
}


Measured memory_bytes: 3620
// https://atcoder.jp/contests/m-solutions2019/tasks/m_solutions2019_b
#include <bits/stdc++.h>
using namespace std;

int main(void){
  string s;
  cin >> s;
  int win = 0;
  int rest = 15 - s.size();

  for (int i = 0; i < s.size(); i++){
    if (s[i] == 'o')
      win++;
  }
  string ans = (win + rest >= 8) ? "YES" : "NO";

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<ctype.h>
#include <string.h>
 
int main(void){
    char w[10], c[1000];
    int wn=0, cn=0, i, count=0;
     
    scanf("%s", w);
    while(w[wn] != '\0') wn++;
     
    while(scanf("%s", c)){
        if(strcmp(c, "END_OF_TEXT") == 0) break;
         
        cn = 0;
        while(c[cn] != '\0') cn++;
         
        for(i=0; i<cn; i++){
            if(c[i]>='A' && c[i]<='Z')
            c[i] = tolower(c[i]);
        }
        if(wn >= cn){
            for(i=0; i<wn; i++){
                if(w[i] != c[i]) break;
                if(i==wn-1){
                    count++;
                }
            }
        }
    }
     
    printf("%d\n", count);
     
    return 0;
}


Measured memory_bytes: 2140
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;

typedef pair<ll,int> P;

vector<ll> dijkstra(int s, vector<vector<P>>g) {//g:隣接リスト（重み付き）
    priority_queue<P,vector<P>,greater<P>> pq;
    vector<ll> dist(g.size(),LINF);
    dist[s]=0;
    pq.push(P(0,s));
    while(!pq.empty()){
        P p = pq.top();pq.pop();
        int from = p.second;
        ll d = p.first;
        if(dist[from] < d)continue;
        for(auto p : g[from]){
            int to = p.second;
            int cost = p.first;
            if(dist[to] > dist[from] + cost){
                dist[to] = dist[from] + cost;
                pq.push(P(dist[to],to));
            }
        }
    }
    return dist;
}

int main() {
    int n,m,s,t;
    cin >> n >> m >> s >> t;
    s--,t--;
    vector<vector<P>> G1(n);
    vector<vector<P>> G2(n);
    rep(i,m){
        int u,v,a,b;
        cin >> u >> v >> a >> b;
        u--,v--;
        G1[u].push_back(P(a,v));
        G1[v].push_back(P(a,u));
        G2[u].push_back(P(b,v));
        G2[v].push_back(P(b,u));
    }
    auto dist1 = dijkstra(s,G1);
    auto dist2 = dijkstra(t,G2);
    vector<ll> dist_total(n);
    rep(i,n)dist_total[i]=dist1[i]+dist2[i];
    vector<ll> dist_min(n);
    dist_min[n-1]=dist_total[n-1];
    for(int i=n-2;i>=0;i--){
        dist_min[i]=min(dist_min[i+1],dist_total[i]);
    }
    rep(i,n)cout << (ll)1e15 - dist_min[i] << endl;
}

Measured memory_bytes: 26684
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int h, w;
    cin >> h >> w;
    akari<seika> g(h);
    for (int i = 0; i < h; i++)
    {
        cin >> g[i];
    }
    int ans = 0;
    for (int s = 0; s < h * w; s++)
    {
        if (g[s / w][s % w] == '#')
        {
            continue;
        }
        queue<int> q;
        akari<int> ds(h * w, -1);
        ds[s] = 0;
        q.push(s);
        while (!q.empty())
        {
            int v = q.front();
            q.pop();
            int x = v % w, y = v / w;
            for (int d = 0; d < 4; d++)
            {
                int nx = x + (d & 2 ? (d & 1 ? 1 : -1) : 0);
                int ny = y + (d & 2 ? 0 : (d & 1 ? 1 : -1));
                //print(x, y, nx, ny);
                if (0 <= nx && nx < w && 0 <= ny && ny < h && g[ny][nx] == '.' && ds[nx + ny * w] == -1)
                {
                    ds[nx + ny * w] = ds[v] + 1;
                    q.push(nx + ny * w);
                }
            }
        }
        ans = max(ans, *max_element(ds.begin(), ds.end()));
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int x = scan.nextInt();
		int t = scan.nextInt();
		
		int ans = 0;
		int a = n/x;
		int b = n%x;
		
		
		if(b == 0) {
			System.out.println(a*t);
		}
		else {
			System.out.println(a*t+t);
		}
	}

}


Measured memory_bytes: 35644
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(), (x).end())
#define Reverse(x) reverse((x).begin(), (x).end())
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15) //15桁まで表示
#define str string
typedef std::pair<int,int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<ui,ui> puu;
typedef pair<int, int> P;
typedef vector<int> vi;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int floor(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};

int main() {
    int n;
    cin >> n;
    cout << 800*n-200*(n/15) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 200005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

P f(int x) {
  int o = pcnt(x) != 1;
  int cnt = 0;
  while (x != 1) {
    x -= x/2;
    cnt++;
  }
  return P(cnt-o,cnt);
}

int main() {
  int n;
  scanf("%d",&n);
  vi a(n);
  cin>>a;
  int ans = 0;
  int pre = 0;
  rep(i,n) {
    P p = f(a[i]);
    // cerr<<a[i]<<" "<<p<<endl;
    mins(pre,p.se);
    if (pre == p.se) {
      pre = p.fi;
    } else {
      ans += p.se-pre;
      pre = p.se;
    }
  }
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	string s;
	cin >> s;
	for (int i = 0; i < (int)s.length(); i++)
	{
		cout << s[i];
		if (i == 3)
		{
			cout << " ";
		}
	}
	cout << endl;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		while(sc.hasNext()) {
			list.add(sc.nextInt());
		}

		int answer = 1000000000;
		int sum;

		for(int i = 1; i <= 100; i++) {
			sum = 0;
			for(Integer j: list) {
				sum += (j - i)*(j - i);
			}

			if(sum < answer) {
				answer = sum;
			}
		}

		System.out.println(answer);
	}
}

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

using namespace std;

#define rep(i, a, n) for(int i = a; i < (n); ++i)
typedef long long ll;

int main(){
    ll a, b, m;
    cin >> a >> b >> m;
    vector<ll> A(a), B(b);
    ll mina = 1e9+7, minb = 1e9+7;
    rep(i, 0, a) 
    {
        cin >> A[i];
        if (mina > A[i])
        {
            mina = A[i];
        }
    }
    rep(i, 0, b) 
    {
        cin >> B[i];
        if (minb > B[i])
        {
            minb = B[i];
        }
    }
    ll x, y, c;
    ll ans = 1e9+7;
    rep(i, 0, m)
    {
        cin >> x >> y >> c;
        --x; --y;
        ll money = A[x] + B[y] - c;
        if (ans > money)
        {
            ans = money;
        }
    }
    if (ans > mina + minb)
    {
        ans = mina + minb;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#define REP(i,n) for(int i=0; i<(n);i++)
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n, k, ans = 0;
    cin >> n >> k;
    int a[n];
    REP(i,n){
        cin>>a[i];
    }
    sort(a,a+n);
    REP(i,k){
        ans+=a[n-i-1];
    }
    cout<<ans;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long llu;

const ll N = 13;
const ll MOD = 1000000007;

ll dp[100010][N];

int main(int argc, char *argv[]) {
  string s;
  cin >> s;

  dp[0][0] = 1;
  for (ll i = 0; i < s.size(); ++i) {
    if (s[i] == '?') {
      for (ll j = 0; j < 10; ++j) {
        for (ll k = 0; k < N; ++k) {
          dp[i+1][(k*10 + j) % 13] += dp[i][k];
          dp[i+1][(k*10 + j) % 13] %= MOD;
        }
      }
    } else {
      ll j = s[i] - '0';
      for (ll k = 0; k < N; ++k) {
        // 例えば1357に対してmod 13したとき
        //
        // 1    ≡ 1
        // 13   ≡ (1*10+3) % 13 ≡ 0
        // 135  ≡ (0*10+5) % 13 ≡ 5
        // 1357 ≡ (5*10+7) % 13 ≡ 5
        // 
        // とできる
        //
        // これを利用して、各0〜12の余り*10 + s[i] を計算して配っていく
        //
        dp[i+1][(k*10 + j) % 13] += dp[i][k];
        dp[i+1][(k*10 + j) % 13] %= MOD;
      }
    }
  }

  cout << dp[s.size()][5] << endl;

  return 0;
}

Measured memory_bytes: 10624
# input
n = gets.chomp.to_i
A = [0] + gets.chomp.split.map(&:to_i)

# define
L = Array.new(n+1, 0)
R = Array.new(n+1, 0)
M = Array.new(n, 0)

# main
(2..n).each do |i|
  L[i] = L[i-1].gcd(A[i-1])
  R[n+1-i] = R[n+2-i].gcd(A[n+2-i])
end
  
n.times do |i|
  M[i] = L[i+1].gcd(R[i+1])
end

# output  
puts M.max


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

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

  FOR(i, 1, 1001) {
    if (ll(i * 0.08) == a && ll(i * 0.1) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
def eight_search(x,y,maze): #i,jからmazeの周辺8つについて調べる
    cnt = 0
    for i in [-1,0,1]:
        for j in [-1,0,1]:
            if i != 0 or j != 0:
                if maze[x+i][y+j] == "#":
                    cnt += 1
    return cnt

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
h,w = map(int,input().split())
maze = [["@" for i in range(w+2)] for j in range(h+2)]
#print(maze)
for i in range(h):
    s = input()
    for j in range(w):
        maze[i+1][j+1] = s[j]
#print(maze)
for i in range(h):
    for j in range(w):
        if maze[i+1][j+1] == "#":
            print("#",end="")
        else:
            print(str(eight_search(i+1,j+1,maze)),end="")
    print()

Measured memory_bytes: 3444