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

public class Main {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int min = 124;
        int max = -1;

        for (int i = 0; i < 5; i++) {
            int n = in.nextInt();
            if (n < min)
                min = n;
            if(n > max)
                max = n;
        }
        int k = in.nextInt();
        System.out.println((max - min <= k) ? "Yay!" : ":(");
        in.close();
    }
}

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

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

    int n;
    cin >> n;

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

        r += max(c - a, 0);
        c = max(c, a);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 3652
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 2147483647;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  string str;
  cin >> str;
  if (str == "ABC")
    cout << "ARC" << endl;
  else
    cout << "ABC" << endl;

  return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;
lint C[2001][2001];
using namespace std;
lint p=1e9+7;
int main(){
  int N,K;
  cin>>N>>K;
  REP(i,N+1)REP(j,N+1)C[i][j]=0;
  REP(i,N+1)C[i][0]=1;
  FOR(i,1,N+1)FOR(j,1,i+1)C[i][j]=(C[i-1][j-1]+C[i-1][j])%p;
  FOR(i,1,K+1){
    cout<<(C[K-1][i-1]*C[N-K+1][i])%p<<endl;
  }
  return 0;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    int n, k;
    cin >> n >> k;
    vector<double> p(n+1);
    p[0] = 0;
    double ptmp;
    rep(i,n) {
        cin >> ptmp;
        p[i+1] = ((ptmp + 1.0) / 2.0);
    }
    rep(i,n) p[i+1] += p[i];
    double ans = 0;
    rep(i,n-k+1) ans = max(ans, p[i+k] - p[i]);
    printf("%.10f\n", ans);

    return 0;
}  

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int h, w;
	cin >> h >> w;
	vvi c(10);
	rep(i, 10) {
		rep(j, 10) {
			int a;
			cin >> a;
			c[i].push_back(a);
		}
	}

	vvi a(h, vi(w));
	rep(i, h) {
		rep(j, w) {
			int t;
			cin >> t;
			if (t == -1) t = 1;
			a[i][j] = t;
		}
	}


	rep(k, 10) {
		rep(i, 10) {
			rep(j, 10) {
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
			}
		}
	}

	ll ans = 0;
	rep(i, h) {
		rep(j, w) {
			ans += c[a[i][j]][1];
		}
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
    int N,M;cin>>N>>M;
    vector<vector<int>> info(3*N);
    queue<pair<int,int>> que;
    int dist[N*3];
    rep(i,3*N)dist[i]=inf;
    rep(i,M){
        int a,b;cin>>a>>b;
        a--;b--;
        info[a*3].push_back(b*3+1);
        info[a*3+1].push_back(b*3+2);
        info[a*3+2].push_back(b*3);
    }
    int S,T;cin>>S>>T;
    S--;T--;
    que.emplace(S*3,0);
    dist[S*3]=0;
    while(!que.empty()){
        int v=que.front().first,d=que.front().second;
        que.pop();
        for(auto i:info[v]){
            if(dist[v]+1<dist[i]){
                dist[i]=dist[v]+1;
                que.emplace(i,dist[i]);
            }
        }
    }
    if(dist[T*3]==inf)cout<<-1<<endl;
    else cout<<dist[T*3]/3LL<<endl;
    return 0;
}

Measured memory_bytes: 17792
import java.util.*;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i <= 2; i++) {
      list.add(sc.nextInt());
    }
    int K = sc.nextInt();
    Collections.sort(list, Collections.reverseOrder());
    for (int i = 0; i < K; i++) {
      list.set(0, list.get(0) * 2);
    }
    System.out.println(list.get(0) + list.get(1) + list.get(2));
  }
}


Measured memory_bytes: 21716
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class Main {

	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int K = sc.nextInt();
			
			double[] as = new double[N];
			for(int i = 0; i < N; i++) {
				final long p = sc.nextLong();
				
				final long sum = p * (p + 1) / 2;
				
				as[i] = (double)(sum) / p;
			}
			
			
			double sum = 0;
			for(int i = 0; i < K; i++) {
				sum += as[i];
			}
			
			double answer = sum;
			for(int i = K; i < N; i++) {
				sum -= as[i - K];
				sum += as[i - 0];
				
				answer = Math.max(answer, sum);
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 42212
#include<stdio.h>

int main() {
	int i, j;
	int h, w;

	while (1) {
		scanf("%d %d", &h, &w);
		if (!(h||w))break;
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				((i + j) % 2) ? printf(".") : printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;

}

Measured memory_bytes: 2604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int N;
  	cin >> N;
    double sum=0;
    rep(i,N){
        double x;
        cin >> x;
        sum+=1/x;
    }
    cout << setprecision(8) << 1/sum;
    


}

/*

南極に住んでるAtCoder AtPolar

 */



Measured memory_bytes: 256
#include <stdio.h>

int main(){
        int i;
        while(scanf("%d", &i) != EOF){
                int n,s = 0;
                for(n = 1;n < 600/i; n++) s += i * (i * n) * (i * n);
                printf("%d\n", s);
        }
        return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, k; cin >> n >> k;
    vector<int> h(n);
    for (int &x : h) {
        cin >> x;
    }
    int res = INT_MAX;
    sort(h.begin(), h.end());
    for (int i = 0; i + k - 1 < n; i++) {
        res = min(res, h[i + k - 1] - h[i]);
    }
    cout << res << "\n";
}


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

int main() {
  int n;
  cin >> n;
  float ans = 2 * n * 3.14159265;
  cout << std::fixed << std::setprecision(3)<< ans << endl;
  return 0;
}


Measured memory_bytes: 3788
import java.util.*;
import java.io.*;
 
public class Main {
    static boolean[][] used;
    static int[] ans;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int cnt = 0;
        int min = 0;
        for(char c : s.toCharArray()){
            if(c == ')'){
                cnt--;
                min = Math.min(min,cnt);
            }else{
                cnt++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for(int i = min; i < 0; i++){
            sb.append("(");
        }
        s = sb.toString()+s;
        cnt = 0;
        for(char c : s.toCharArray()){
            if(c == ')'){
                cnt--;
                
            }else{
                cnt++;
            }
        }
        sb.setLength(0);
        for(int i = 0; i < cnt; i++){
            sb.append(")");
        }
        s += sb.toString();
        System.out.println(s);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k % 2 == 0) cout << a - b << endl;
    else cout << b - a << endl;
}


Measured memory_bytes: 3604
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, D = get_ints

count = 0
N.times do |i|
  x, y = get_ints
  test = Math.sqrt(x ** 2 + y ** 2)
  count += 1 if test <= D
end

puts count


Measured memory_bytes: 14464
#include<bits/stdc++.h>
using namespace std ;
int main(){
int a , cnt = 0;
cin >> a ;
 for ( int i = 1 ; i <= a ; i ++  ){
    for ( int j = 1 ; j <= a ; j ++ ) {
        for ( int k = 1 ; k <= a ; k ++ ){
            cnt += __gcd( i , __gcd( j , k ) ) ;
        }
    }
 }
 cout << cnt ;

}


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

static const int MAX_N = 100010;
int N, a;
int count_num[MAX_N] = {0};
int ans = 0;

int main(){
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a;
    if(a > 100000) ans++;
    else count_num[a]++;
  }
  for(int i = 1; i<=100000; i++){
    if(count_num[i] == 0 || count_num[i] == i) continue;
    if(count_num[i] < i) ans+=count_num[i];
    if(count_num[i] > i) ans+=(count_num[i]-i);
  }
  cout << ans << endl;
  return 0;
}

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
//using P = pair<double, double>;
using edge = struct {int to; ll cost;};

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()

const int di[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dj[] = {0, -1, 0, 1, 1, -1, 1, -1};
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;

struct prime
{
  vector<bool> num;
  prime(int n) : num(n+1, true)
  {
    num[0] = false;
    num[1] = false;
    for(int i = 2; i <= n; i++) {
      if(num[i]) {
        for(int j = 2; i*j <= n; j++) num[i*j] = false;
      }
    }
  }
  bool isPrime(int x)
  {
    return num[x];
  }
};
struct UnionFind {
    vector<int> par;
    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
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*(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;
  }
};
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

long long gcd(long long a, long long b)
{
  if (a < b)
    swap(a, b);
  while (true)
  {
    if (a % b == 0ll)
      break;
    ll _a = a;
    a = b;
    b = _a % b;
  }
  return b;
}

long long lcm(long long a, long long b)
{
  return (max(a, b) / gcd(a, b)) * min(a, b);
}


void solve()
{
  int n, m;
  cin >> n >> m;
  if(m >= n) cout << "Yes" << "\n";
  else cout << "No" << "\n";
}

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


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
int main(void){
  int n,x;
  int a[100];
  int sum=0;
  int min = 1000;
  std::cin >> n >> x;
  for(int i=0;i<n;i++){
    std::cin >> a[i];
    sum += a[i];
    if(min > a[i]){
      min = a[i];
    }
  }
  printf("%d",n+(x-sum)/min);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed  main(){
	string  a,b;
      int c,d;
  cin>>a>>b;
  a = a + b;
  c = std::atoi(a.c_str());
  d = sqrt(c);
  if(d*d==c){
    cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }
}

Measured memory_bytes: 256
import Data.Char

s n = [ "w", "", "k", "s", "t", "n", "h", "m", "y", "r" ]!!n

b 'T' = "a"
b 'L' = "i"
b 'U' = "u"  
b 'R' = "e"  
b 'D' = "o"

ans1 [] = []
ans1 ('0':'U':ls) = "n":"n":(ans1 ls)
ans1 (l:ls) =
  let n = digitToInt l :: Int
  in
    (s n):(ans2 ls)

ans2 (l:ls) = (b l):(ans1 ls)

main = do
  l <- getLine
  let o = concat $ ans1 l
  putStrLn o



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

int main() {
        int m[1000], f[1000], r[1000], s[1000], i, j;
        for(i = 0; i < 1000; i++) {
                cin >> m[i] >> f[i] >> r[i];
                if (m[i] == -1 && f[i] == -1 && r[i] == -1) break;
        }
        for(j = 0; j < i; j++) {
                s[j] = m[j] + f[j];
                if (m[j] == -1 || f[j] == -1 || s[j] < 30) cout << "F" << endl;
                else if (s[j] < 50) {
                        if (r[j] < 50) cout << "D" << endl;
                        else cout << "C" << endl;
                }
                else if (s[j] < 65) cout << "C" << endl;
                else if (s[j] < 80) cout << "B" << endl;
                else cout << "A" << endl;
        }
        return 0;
}

Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	}
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n;
		String[] name = new String[1000];
		int[] p = new int[1000];
		int[] q = new int[1000];
		int[] r = new int[1000];
		while ((n = in.nextInt()) != 0) {
			for (int i = 0; i < n; i++) {
				name[i] = in.next();
				p[i] = in.nextInt();
				q[i] = in.nextInt();
				r[i] = in.nextInt();
			}
			int P = in.nextInt();
			int Q = in.nextInt();
			int R = in.nextInt();
			int C = in.nextInt();
			boolean isNA = true;
			for (int i = 0; i < n; i++) {
				if (p[i] <= P && q[i] <= Q && r[i] <= R
						&& (p[i] + r[i]) * 4 + q[i] * 9 <= C) {
					System.out.println(name[i]);
					isNA = isNA && false;
				}
			}
			if (isNA) {
				System.out.println("NA");
			}
		}
	}
}

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


int N;
int a[101];
int cnt[101];
//-----------------------------------------------------------------
string solve() {
	sort(a, a + N);

	if (N == 2) {
		if (a[0] == 1 && a[1] == 1)
			return "Possible";
		else
			return "Impossible";
	}

	if (N == 3) {
		if (a[0] == 1 && (a[1] == 2) && (a[2] == 2))
			return "Possible";
		else
			return "Impossible";
	}

	if (a[0] == 1) {
		rep(i, 1, N) if (a[i] != 2) return "Impossible";
		return "Possible";
	}

	int m = (a[N - 1] - 1) / 2 + 1;
	rep(i, 0, N) if (a[i] < m) return "Impossible";

	rep(i, 0, N) cnt[a[i]]++;
	rep(i, m + 1, a[N - 1] - 1) if (cnt[i] == 0) return "Impossible";
	if (cnt[a[N - 1]] < 2) return "Impossible";
	if (a[N - 1] % 2 == 1) {
		if (cnt[m] != 2) return "Impossible";
	} else {
		if (cnt[m] != 1) return "Impossible";
	}

	return "Possible";
}
//-----------------------------------------------------------------
int main() {
	cin >> N;
	rep(i, 0, N) cin >> a[i];
	
	cout << solve() << endl;
}

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

int main(){
  int N, P;
  string S;
  cin >> N;
  vector<tuple<string, int, int>> vec;

  for(int i=0;i<N;i++){
    cin >> S >> P;
    vec.push_back(make_tuple(S,-P,i+1));
  }

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

  for(int i=0;i<N;i++){
    cout << get<2>(vec[i]) << endl;
  }
}

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

#define FAST_IO                       \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);

using namespace std;

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

const int MOD = 1e9 + 7;

int main()
{

	FAST_IO;

	
	string s;
	cin>>s;
	if(s == "AAA" || s == "BBB")
		cout<<"No";
	else
		cout<<"Yes";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) ((a)>(b))? (a):(b)
#define min(a,b) ((a)<(b))? (a):(b)
int main()
{
  int n,k;
  cin>>n>>k;
  vector<long long>a(n);
  vector<long long>ans(n);
  int f=1,j=0;
  for(int i=0;i<n;i++)cin>>a[i];
  while(j!=k)
  {
    
    f=1;
    vector<int>t(n);
    int count=0;
    for(int i=0;i<n;i++)
    {
      if(i==0)ans[i]=1;
      else ans[i]=count+1;
      if(a[i]>0)
      {
        t[min(i+a[i],n-1)]++;
      	count++;
      }
      
      if(t[i])count-=t[i];
      t[i]=0;
      //cout<<ans[i]<<" ";
    }
    count=0;
    //cout<<endl;
    for(int i=n-1;i>=0;i--)
    {
      if(i!=n-1)ans[i]+=count;
      if(a[i]>0)
      {
        t[max(i-a[i],0)]++;
        count++;
      }
      
      if(t[i])count-=t[i];
      t[i]=0;
      a[i]=ans[i];
      if(a[i]<(n-1))f=0;
      //cout<<ans[i]<<" ";
    }
    j++;
    if(f)break;
  }
  if(j==k)for(int i=0;i<n;i++)cout<<ans[i]<<" ";
  else for(int i=0;i<n;i++)cout<<n<<" ";
  return 0;
}

Measured memory_bytes: 7120
var
	S:String;
	id:Longint;
begin
	readln(S);
	id:=length(S);
	while id>0 do begin
		if(id>=5)and(copy(S,id-4,5)='dream')then dec(id,5)else if(id>=7)and(copy(S,id-6,7)='dreamer')then dec(id,7)else if(id>=5)and(copy(S,id-4,5)='erase')then dec(id,5)else if(id>=6)and(copy(S,id-5,6)='eraser')then dec(id,6)else begin writeln('NO');exit;end;
	end;
	writeln('YES');
end.


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<ll, ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
//#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
#define INF 1e18
#define inf 1e10
#define NINF -1e16

#define N 1000005
int spf[N];
vll primes,prev[N],next[N];
set<int>s;
void sieve()
{
	rep(i,2,N)
	{
		if (spf[i]==0)
		{
			spf[i]=i;
			for(int j=2*i;j<=N;j+=i)
			{
				if(spf[j]==0)
					spf[j]=i;
			}
		}
	}
}
void SieveOfEratosthenes(int n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*2; i<=n; i += p) 
                prime[i] = false; 
        } 
    }
    for (int p=2; p<=n; p++) 
    {
        if (prime[p]) 
        {
            primes.pb(p); 
            s.insert(p);
        }
    }    
} 
// bool isPrime(ll n) 
// { 
//     if (n <= 1) 
//         return false; 
//     if (n <= 3) 
//         return true; 
//     if (n % 2 == 0 || n % 3 == 0) 
//         return false; 
//     for (int i = 5; i * i <= n; i = i + 6) 
//         if (n % i == 0 || n % (i + 2) == 0) 
//             return false; 
//     return true; 
// } 
// ll power(ll x,ll y)
// {
//     ll X=x;
//     //X=X%p;//if x is greater than p
//     if(X==0)
//     {
//         return 0;
//     }
//     ll res=1ll;
//     while(y>0)
//     {
//         if(y&1)
//         {
//             res=((res)*(X));
//             y--;
//         }
//         y=y>>1;
//         X=((X)*(X));
//     }
//     // res=(res>=0)?(res%p):(res+p)%p;
//     return(res);
// }
// void dfs(int u, int par){
//     cnt[u] = 1;
//     p[u] = par;
//     for(int i : g[u]){
//         if(i != par){
//             dfs(i,u);
//             cnt[u] += cnt[i];
//         }
//     }
// }
// int children(vll v[],int parent,int src,vll& chil)
// {
// 	int ans =0;
// 	for(auto it:v[src])
// 	{
// 		if(it!=parent)
// 		{
// 			ans+= 1+children(v,src,it,chil);
// 		}
// 	}
// 	chil[src] = ans;
// 	return ans;
 
// }
bool cmp(const pair<int,int>&a,const pair<int,int>&b)
{
    if (a.F==b.F)
    return a.S<b.S;
    else
    return a.F>b.F;
}
signed main() {
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand (static_cast <unsigned> (time(0)));
	SieveOfEratosthenes(1000005); 
// 	sort(all(primes));
    sieve();
	int t=1;
	//cin >> t;
	while (t--) 
	{
	    string s;
	    cin >> s;
	    if (s[sz(s)-1]=='s')
	    cout << s <<"es";
	    else
	    cout <<s<<"s";
	}
	return 0;
}

Measured memory_bytes: 63140
from collections import Counter
from scipy.sparse.csgraph import floyd_warshall

H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]


num_counter = Counter()
for i in range(H):
    num_counter += Counter(A[i])

if -1 in num_counter:
    del num_counter[-1]

if 1 in num_counter:
    del num_counter[1]

nei_graph = floyd_warshall(C, directed=True)

ans = 0
for k, v in num_counter.items():
    ans += nei_graph[k][1] * v

print(int(ans))



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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int cnt=0;
  for(int i=1;i<n-1;i++){
    if((a[i]-a[i-1])*(a[i]-a[i+1])<0){
    cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
h,w,k = map(int,input().split())

c = [list(input()) for i in range(h)]

ans = 0
for b1 in range(2**h):
    for b2 in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (b1 >> i) & 1 == 0 and (b2 >> j) & 1 == 0 and c[i][j] == "#":
                    black +=1
                    
        if black == k:
            ans += 1

print(ans)

Measured memory_bytes: 9144
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

/*lld fac[100001]; 

void getfac(lld p)
{
    fac[0] = 1; 
    for (lld i=1 ; i<=100000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrmodp(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}*/


lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;


void solve()
{
    cin>>n;
    vector<lld> v(1000001),w(1000001);
    for(i=0;i<n;i++)
    {
        cin>>l;
        v[l]+=1;
    }
    ans=0;
    for(i=1;i<1000001;i++)
    {
        if(v[i])
        {
            if(w[i]==0)
            {
                if(v[i]==1)
                {
                    ans+=1;
                }
                for(j=i;j<1000001;j+=i)
                {
                    w[j]=1;
                }
            }
        }
    }
    cout<<ans;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    //cin>>t;
    //cout<<t;
   //  getfac(p2);
    //check the value by which modulo is to be taken
    lld ans=0;
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
                  solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 18772
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

int main()
{
   int n, m, p[N] = {}, y[N] = {};
   vector<int> v[N];
   cin >> n >> m;

   FOR(i, 0, m)
   {
      cin >> p[i] >> y[i];
      v[p[i]].push_back(y[i]);
   }
   FOR(i,0,N)
   sort(ALL(v[i]));


   FOR(i, 0, m)
   {
      cout << setfill('0') << right << setw(6) << p[i];
      cout << setw(6) << lower_bound(ALL(v[p[i]]),y[i])-v[p[i]].begin()+1 << endl;
   }
   return 0;
}


Measured memory_bytes: 7808
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MOD = 1e9+7;
#define MAX 510000

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll Pmod(ll n, ll k){
  ll res = (fac[n]*finv[n-k])%MOD;
  return res;
}
signed main(){
  init_io();
  ll n,m,ans=0;
  COMinit();
  cin >> n >> m;
  for(ll i=0;i<=n;i++){
    ll keta = (i%2)?-1:1;
    ll p0,p1;
    p0 = Pmod(m,i);
    p1 = Pmod(m-i,n-i);
    p1 = (p1*p1)%MOD;
    p1 %= MOD;
    p0 *= p1;
    p0 %= MOD;
    ans = (ans + MOD +keta *(p0*COM(n,i)))%MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 15584
#pypyは内包表記使わない, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 1000000007

    a,b,c,d = map(int, input().split())
    if abs(a-c)<=d:
        print('Yes')
    elif abs(a-b)<=d and abs(b-c)<=d:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

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

    return sum;
}

int main()
{
    ll n,ans = 0;
    cin >> n;
    vll a(n+1),b(n);
    rep(i,n+1)cin >> a[i];
    rep(i,n)cin >> b[i];

    rep(i,n){
        if(a[i] <= b[i]){
            b[i] -= a[i];
            ans += a[i];
            a[i] = 0;
        }

        else{
            a[i] -= b[i];
            ans += b[i];
            b[i] = 0;
        }

        if(a[i+1] <= b[i]){
            b[i] -= a[i+1];
            ans += a[i+1];
            a[i+1] = 0;
        }

        else{
            a[i+1] -= b[i];
            ans += b[i];
            b[i] = 0;
        }

        //cout << b[i] << endl;
    }

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

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

ll mod = 1e9+7;

int main(){
    int N, X;
    cin >> N >> X;
    vector<int> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    sort(S.begin(), S.end());
    reverse(S.begin(), S.end());
    vector<vector<ll>> dp(N+1, vector<ll>(X+1, 0));
    dp[0][X]++;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= X; j++) {
            dp[i+1][j] += (N-1-i)*dp[i][j];
            dp[i+1][j] %= mod;
            dp[i+1][j%S[i]] += dp[i][j];
            dp[i+1][j%S[i]] %= mod;
        }
    }
    ll ans = 0;
    for (int i = 1; i < S[N-1]; i++) ans = (ans + i*dp[N][i])%mod;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define PROBLEM "C"

#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)

int main(int argc, char const *argv[])
{
	#ifdef DBG
	freopen(PROBLEM ".in", "r", stdin);
	freopen(PROBLEM ".out", "w", stdout);
	#endif

	int N, tmp_1, tmp_2, ans;
	while(cin >> N){
		ans = 0;
		tmp_1 = tmp_2 = 0;
		for (int i = 0; i < N-1; ++i){
			//cout << "i: " <<i<<endl;
			if(i % 2){
				cin >> tmp_2;
				//cout<<"tmp_2: "<<tmp_2<<endl;

				if (tmp_2 > tmp_1)
					ans += tmp_1;
				else
					ans += tmp_2;
				if (i == N-2)
					ans += tmp_2;
			}
			else{
				cin >> tmp_1;
				//cout << "tmp_1: "<<tmp_1<<endl;
				if (i == 0){
					ans += tmp_1;
				}
				if (tmp_1 > tmp_2 )
					ans += tmp_2;
				else
					ans += tmp_1;
				if (i == N-2)
					ans += tmp_1;
			}
			//cout << ans <<endl;
			
			
		}
		cout << ans << endl;

	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
using ll = long long;

int N, W;
ll w[110], v[110], INF = 1000000000000, dp[110][100100], V_SUM;

int main(){
	cin >> N >> W;
	for (int i = 0; i < N; i++){
		cin >> w[i] >> v[i];
		V_SUM += v[i];
	}
	for (int i = 0; i <= V_SUM; i++)dp[0][i] = INF;
	dp[0][0] = 0;
	for (int i = 0; i < N; i++){
		for (int j = 0; j <= V_SUM; j++){
			if (j >= v[i]) dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
			else dp[i + 1][j] = dp[i][j];
		}
	}
	ll ans = 0;
	for (int i = 0; i <= V_SUM; i++)if (dp[N][i] <= W)ans = i;
	cout << ans << endl;
}


Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

void solve() {
  int N; cin >> N;
  vi money(N+1, N);
  money[0] = 0;
  vi withdraw;
  withdraw.push_back(1);
  for (int i=6; i<=N; i*=6) withdraw.push_back(i);
  for (int i=9; i<=N; i*=9) withdraw.push_back(i);
  sort(withdraw.begin(), withdraw.end());

  for (int i=1; i<=N; ++i) {
    for (auto v : withdraw) {
      if (v > i) break;
      money[i] = min(money[i], money[i-v]+1);
    }
  }

  cout << money[N] << endl;
  return;
}

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


Measured memory_bytes: 640
main = putStrLn =<< solve <$> getLine

solve :: String -> String
solve s = solve' s ""

solve' :: String -> String -> String
solve' [] s = s
solve' (x:xs) s
    | x == '0' = solve' xs $ s ++ "0"
    | x == '1' = solve' xs $ s ++ "1"
    | x == 'B' = if s == [] then solve' xs s else solve' xs $ init s
    | otherwise = error "unexpected char"


Measured memory_bytes: 380
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <math.h>
#include <iomanip>

typedef long long ll;
using namespace std;

int main() {
    string s;
    int n,m;
    cin >> n >> m;
    if (n <= 12) m /= 2;
    if ( n<= 5) m *= 0;
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
 
int main(void){
  int x,y,z;
  
  // 標準入力
  std::cin >> x >> y >> z;
  
  // 文字入替
  using std::swap;
  swap(x, y);
  swap(x, z);
  
  // 文字出力
  std::cout << x << " " << y << " " << z;
  
  return 0;
  
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000007
#define maxn 1000000009
vector<pair<int, int>> BA;
int main()
{
    int N;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        BA.emplace_back(b, a);
    }
    sort(BA.begin(), BA.end());
    int sum = 0;
    bool check = true;
    for (auto v : BA)
    {
        sum += v.second;
        if (sum > v.first)
        {
            check = false;
            break;
        }
    }
    cout << (check ? "Yes" : "No") << endl;
}


Measured memory_bytes: 2420
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
ll in(){ll x; cin >> x; return x;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n;
	cin >> n;
	Vec p(n);
	rep(i, n) cin >> p[i];
	Vec s(n, 9e8);
	rep(i, n) s[p[i]-1] += i;

	Vec a(n), b(n);
	rep(i, n){
		if(!i){
			a[0] = 1; b[0] = s[0]-a[0];
		}else{
			repn(j, LINF){
				if(s[i]-(a[i-1]+j) < b[i-1] && s[i]-(a[i-1]+j) > 0){
					a[i] = a[i-1]+j;
					b[i] = s[i]-a[i];
					break;
				}
			}
		}
	}
	coVec(a);
	coVec(b);

	return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
/********************************************************************************/
int n,m,k;
int a,b,c,d;
int a2[100010];
string s;
vs v;
set<string> s2;
int main()
{
	cin>>n;
	rep(i,n)
	{
		cin>>s;
		s2.insert(s);
	}
	cout<<s2.size();
    return 0;
}

Measured memory_bytes: 19184
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    ll x;
    cin >> x;
    for(ll i = 1; i <= 2*sqrt(x); i++){
        ll t = i*(i+1)/2;
        if(x <= t){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256