akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

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

    int res = 0;
    if (n >= 10) {
        res = m;
    }
    else {
        res = m + 100 * (10 - n);
    }
    cout << res;

    return 0;
}


Measured memory_bytes: 256
while True:
    po=input()
    if po=="0":
        break
    A,B=0,0
    for i in range(1,len(po)):
        if po[i]=="A":
            A+=1
        else :
            B+=1
    if A>B:
        A+=1
    else :
        B+=1
    print(A,B)


Measured memory_bytes: 5560
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;



int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);


    vector<long> a(n);
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
    }
    sort(a.begin(), a.end());

    if(n%2==0) {
        for(i=0; i<n; i++) {
            if(a[i]!=i/2*2+1) {
                printf("0\n"); return 0;
            }
        }
    }
    else {
        for(i=0; i<n; i++) {
            if(a[i]!=(i+1)/2*2) {
                printf("0\n"); return 0;
            }
        }
    }

    ll ans=1;
    long m=n/2;
    for(i=0; i<m; i++) {
        ans = ans*2 %MOD;
    }
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 1024
from functools import lru_cache

@lru_cache(maxsize=None)
def solve(i, count):
    global ans
    global a
    if count >= N:
        return
    if ans[i][0] == -1:
        ans[i][0] = count
    elif ans[i][0] > count:
        ans[i][0] = count

    for x in range(a[i][1]):
        solve(a[i][2 + x] - 1, count + 1)


N = int(input())
a = []
for _ in range(N):
    a.append([int(x) for x in input().split()])

ans = [[-1 for i in range(1)] for j in range(N)]

solve(0, 0)

for i, x in enumerate(ans):
    print(i + 1, *x)






Measured memory_bytes: 6844
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];


int main(){
 string a,b;cin>>a>>b;
 ll ans=0;
 rep(i,0,a.size()){
   if(a[i]!=b[i]){
     ans++;
   }
 }
 cout<<ans<<endl;
}



Measured memory_bytes: 3924
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a.at(i).at(j);
    }
  }
  vector<bool> row(H, false);
  vector<bool> col(W, false);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) == '#') {
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  for (int i = 0; i < H; i++) {
    if (row.at(i)) {    
     for (int j = 0; j < W; j++) {
       if (col.at(j)) cout << a.at(i).at(j);
     }
     cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#ifdef LOCAL
#define see(x) cout  << #x << ": " << (x) << endl
#endif

#ifndef LOCAL
#define see(x)
#endif

template<typename T>
void print(const T &t) {
    cout << t << '\n';
}

template<typename T, typename ...Args>
void print(const T &t, const Args &...rest) {
    cout << t << ' ';
    print(rest...);
}

// this overload is chosen when there's only one argument
template <class T>
void scan(T &t){
    cin >> t;
}

template<class T, class ...Args>
void scan(T &a, Args &...rest){
     cin >> a;
     scan(rest...);
}


using vec = vector<int>;
using mat = vector<vec>;
using pii = pair<int,int>;

using ll = long long;
const int mod = 1e9+7;
const int N = 1e5+5;
const int M = 1<<20;

int x[N];
int d[N];

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    //    ios::sync_with_stdio(false);
    //    cin.tie(nullptr);
    /////////////////////////////////////////////////////
    // 为何我的代码写得如此啰嗦？
    int n;
    scan(n);
    for(int i=1; i<=n; i++)
        scan(x[i]);
    for(int i=1; i<=n; i++)
        d[i] = d[i-1] + abs(x[i-1]-x[i]);
    d[n+1] = d[n] + abs(x[n]);
    for(int i=1; i<=n; i++){
        int ans = d[i-1] + d[n+1] - d[i+1] + abs(x[i-1]-x[i+1]);
        print(ans);
    }
    return 0;
}


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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S;
  cin >> S;
  stack<char> s;
  s.push(S.at(0));
  int l = S.length();
  int ans = 0;
  for (int i = 1; i < l; ++i) {
    if (s.size() > 0 && s.top() != S.at(i)) {
      ans += 2;
      s.pop();
    } else {
      s.push(S.at(i));
    }
  }

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


Measured memory_bytes: 512
n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

print(dp[n-1])

Measured memory_bytes: 13928
S = input()

ans = 0
l = 0
r = len(S)-1

while l < r :
    if S[l] == S[r] :
        l += 1
        r -= 1
    elif S[l] == "x" :
        l += 1
        ans += 1
    elif S[r] == "x" :
        r -= 1
        ans += 1
    else :
        ans = -1
        break

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;

void fn(int A, char B, string ans){
  if( ans.size() == A ){
    cout << ans << endl;
    return;
  }else{
    for( char c = 'a'; c <= B+1; c++ ){
      string S = ans + c;
      fn(A, max(B, c), S);
    }
  }
}

signed main(){
  
  int N;
  cin >> N;
  
  fn(N, 'a'-1, "");
    
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, 0, n){
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());
	int ans = 0;
	rep(i, k, n){
		ans += a[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
function Main(input){
    a=input.split(" ");
    if(Number(a[1])%Number(a[0])==0)console.log(Number(a[0])+Number(a[1]));
    else console.log(Number(a[1])-Number(a[0]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  int K,X;in(K,X);
  out(500*K>=X?"Yes":"No");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class Main{

	public static void main(String[] args) throws IOException {
		BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw =new PrintWriter(System.out);
		StringTokenizer st= new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());
		char[][] grid= new char[H][W];
		long[][] solution= new long[H][W];
		for (int i = 0; i < grid.length; i++) {
			String s=br.readLine();
			for (int j = 0; j < grid[i].length; j++) {
				grid[i][j]=s.charAt(j);
	
			}
		}
		for (int i = solution.length-1; i > -1; i--) {
			for (int j = solution[i].length-1; j > -1; j--) {
				if(grid[i][j]=='#')
				{
					solution[i][j]=0;
				}
				else if(i+1>=solution.length && j+1>=solution[i].length)
				{
					solution[i][j]=1;
				}
				else if(i+1>=solution.length)
				{
					solution[i][j]=solution[i][j+1];
				}
				else if(j+1>=solution[i].length)
				{
					solution[i][j]=solution[i+1][j];
				}
				else
				{
					solution[i][j]=(solution[i][j+1]+solution[i+1][j])%(1000000000+7);
				}
					
					
			}
		}
		pw.println(solution[0][0]%(1000000000+7));
		pw.close();
	}
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

ll A, B, C;

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    std::cin >> A >> B >> C;

    ll res = B + std::min(C, A + B + 1);
    std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int sum[maxn];
int main()
{
    string s;
     int m,n;
     scanf("%d%d",&m,&n);
      cin>>s;
      sum[0]=0;
      for(int i=1;i<s.size();i++)
      {
          if(s[i-1]=='A'&&s[i]=='C')
           sum[i]=sum[i-1]+1;
           else
            sum[i]=sum[i-1];
      }
      int x,y;
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&x,&y);
        printf("%d\n",sum[y-1]-sum[x-1]);
    }

    return 0;
}


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

int main() {
    string s;
    cin >> s;
    while (s.size() > 0) {
        int n = s.size();
        if (n >= 5 && s.substr(n-5, 5) == "dream" || s.substr(n-5, 5) == "erase") {
            s.erase(n-5, 5);
        }
        else if (n >= 7 && s.substr(n-7, 7) == "dreamer") {
            s.erase(n-7, 7);
        }
        else if (n >= 6 && s.substr(n-6, 6) == "eraser") {
            s.erase(n-6, 6);
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
} 


Measured memory_bytes: 512
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin>>n;
    if(n==1){
    	cout<<"Hello World"<<endl;
    }
    else{
    	int a,b;
    	cin>>a>>b;
    	a+=b;
    	cout<<a<<endl;	
    }
    return 0;   
}



Measured memory_bytes: 256
import collections
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M,C = IL()
B = IL()
A = [IL() for i in range(N)]

arB = np.array(B)

cnt = 0
for i in range(N):
    arA = np.array(A[i])
    tmp = np.sum(arA*arB)
    if tmp+C > 0:
        cnt += 1
print(cnt)

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

int main(){
    string s;
    cin >> s;
    int z = 0;
    int o = 0;
    for(int i = 0; i < s.size(); i++){
        if(s.at(i) == '0'){
            z++;
        } else {
            o++;
        }
    }
    cout << min(z,o)*2;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

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

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

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

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  s += s;
  string t = "SW";
  rep(j, 2) rep(k, 2) {
    string acc;
    acc += t[j];
    acc += t[k];
    repi(i, 2, n + 3) {
      if ((s[i - 1] == 'o') ^ (acc[i - 1] == 'S')) {
        acc += acc[i - 2] == 'S' ? 'W' : 'S';
      } else {
        acc += acc[i - 2];
      }
    }
    if (acc[0] == acc[n] && acc[1] == acc[n + 1]) {
      cout << acc.substr(0, n) << endl;
      return;
    }
  }
  cout << -1 << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n));
    for (int i=0; i<2; i++) {
        for (int j=0; j<n; j++) {
            cin >> a[i][j];
        }
    }
    vector<vector<int>> maxsum(2, vector<int>(n));
    maxsum[0][0] = a[0][0];
    for (int i=1; i<n; i++) maxsum[0][i] = maxsum[0][i-1] + a[0][i];
    maxsum[1][0] = a[0][0] + a[1][0];
    for (int i=1; i<n; i++) maxsum[1][i] = max(maxsum[1][i-1], maxsum[0][i]) + a[1][i];
    /*for (int i=0; i<2; i++) {
        for (int j=0; j<n; j++) {
            cout << maxsum[i][j] << " ";
        }
        cout << endl;
    }*/
    if (n == 1) maxsum[1][0] = a[0][0] + a[1][0];
    cout << maxsum[1][n-1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

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

  sort(all(a));

  // 小さいほうから順に足し合わせながら種類カウントを増やす
  // 2倍ではたりなくなったら種類カウントをリセットする

  ll ans = 1;
  ll acc = a[0];
  for (int i = 1; i < n; i++) {
    if(acc * 2 >= a[i]) {
      //2倍以下なら選べる
      ans++;
    } else {
      ans = 1;
    }

    acc += a[i];
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
using namespace std;

long long a[105];

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

long long lcm(long long a,long long b)
{
    long long r  = gcd(a,b);
    return a / r * b / r * r;
}

int main()
{
    int n;

    scanf("%d",&n);

    for (int i = 0;i < n;i++)
        scanf("%lld",&a[i]);

    sort(a,a+n);

    long long ans;

    if (a[n-1] % a[0] == 0) ans = a[n-1];
    else ans = lcm(a[n-1],a[0]);

    for (int i = 1;i < n;i++)
    {
        if (ans % a[i] == 0) continue;
        else ans = lcm(ans,a[i]);
    }

    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  int hand[5];
  while(scanf("%d,%d,%d,%d,%d",&hand[0],&hand[1],&hand[2],&hand[3],&hand[4])!=EOF){
    int c[13] = {0};
    int v[5] = {0};
    bool f = true;
    sort(hand,hand+5);
    for(int i = 0; i < 5; i++){
      if(hand[0] != hand[i] - i){
	f = false;
      }
      c[hand[i] - 1]++;
    }
    if(c[0] && c[9] && c[10] && c[11] && c[12]){
      f = true;
    }
    for(int i = 0; i < 13; i++){
      v[c[i]]++;
    }

    if(v[4]) puts("four card");
    else if(v[3] && v[2]) puts("full house");
    else if(f) puts("straight");
    else if(v[3]) puts("three card");
    else if(v[2] == 2) puts("two pair");
    else if(v[2]) puts("one pair");
    else puts("null");
  }
}

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, Npow, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
//***********//
int main() {
	double R;
	cin >> R;
	double PI = 3.14159265358979323846;
	R *= 2 * PI;
	cout << fixed << setprecision(12) << R;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

	ll n,k;
	cin>>n>>k;
	ll p[n];
	for(int i=0;i<n;i++)
		cin>>p[i];
	sort(p,p+n);
	ll ans = 0;
	for(int i=0;i<k;i++)
		ans += p[i];
	cout<<ans<<endl;
}

Measured memory_bytes: 3692
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.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;
}

int main(void) {
    int K, A, B;
    cin >> K >> A >> B;

    if (A % K != 0) {
        int x = (A + K - 1) / K;
        int y = B / K;
        if (y - x >= 0) {
            cout << "OK" << endl;
        } else {
            cout << "NG" << endl;
        }
    } else {
        cout << "OK" << endl;
    }

    return 0;
}


Measured memory_bytes: 3596
#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, K;
  cin >> N >> K;
  string S;
  cin >> S;
  S[K - 1] = S[K - 1] + 32;
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ct=0,vis[200009];
vector<ll> v[200009];
void dfs(int j)
{
	vis[j]=1;
	for(int i=0;i<v[j].size();i++)
	{
		if(!vis[v[j][i]])
		{
			vis[v[j][i]]=1;
			ct++;
			dfs(v[j][i]);
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);   
	ll n,a[200009],m,k,ans=INT_MIN,fl=0;
	string s;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		ll x,y;
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	for(int i=1;i<=n;i++)
		vis[i]=0;
	for(int i=1;i<=n;i++)
	{
		ct=1;
		if(!vis[i])
		{
			dfs(i);
			ans=max(ct,ans);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 22316
package main

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

func main() {
	sc := newScanner()
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	b, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	c, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())

	ans := solve(a, b, c, k)
	fmt.Println(ans)
}

func solve(a, b, c, k int) (ans int) {
	if k <= a {
		return k
	} else if k <= a+b {
		return a
	} else if k <= a+b+c {
		return a - (k - a - b)
	} else {
		return a - c
	}
}

func newScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return sc
}


Measured memory_bytes: 1756
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdio>
using namespace std;

#define int long long
#define INF 1e18

signed main() {
    string s; cin >> s;
    string t = "";
    t += s[0];
    t += to_string(s.size() - 2);
    t += s[s.size() - 1];
    cout << t << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> t(n), a(n);
  rep(i, n) cin >> t[i] >> a[i];
  
  ll T=1, A=1;
  rep(i, n) {
    ll x = (T+t[i]-1)/t[i];
    ll y = (A+a[i]-1)/a[i];
	T = max(x,y)*t[i];
	A = max(x,y)*a[i];
  }
  cout << T+A << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
ll fac[205];
int cnt[205],tot;
int main(){
	reg ll n;scanf("%lld",&n);
	reg ll x=n;
	for(reg int i=2;1ll*i*i<=x;i++)
		if(x%i==0){
			fac[++tot]=i;
			while(x%i==0)x/=i,cnt[tot]++;
		}
	reg int Ans=0;
	if(x>1)Ans++;
	for(reg int i=1;i<=tot;i++){
		reg int t=1;
		while(cnt[i]>=t){
			cnt[i]-=t;t++;Ans++;
		}
	}
	printf("%d\n",Ans);
	return 0;
}

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    REP(i, m) cin >> a[i];
    
    /* 最上位から決めるためにソート */
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    vector<int> dp(n+1, -1);
    /* dp[i]: ちょうどi本作って作れる桁数の最大値 */

    int match_num[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    dp[0] = 0;
    REPN(i, 1, n+1) {
        REP(j, m) {
            int prev = i - match_num[a[j]];
            if(prev >= 0 && dp[prev] != -1) {
                dp[i] = max(dp[i], dp[prev] + 1);   
            }
        }
    } 

    vector<int> ans;
    int ketasu = dp[n];
    int honsu = n;
    
    /* 最上位から決めていく */
    REP(i, ketasu) {
        REP(j, m) {
            if(honsu - match_num[a[j]] >= 0){
                if((dp[honsu] - 1) == dp[honsu - match_num[a[j]]]) {
                    ans.push_back(a[j]);
                    honsu -= match_num[a[j]];
                    break;
                }
            }
        }
    }

    //cout << honsu << endl;

    for(auto a: ans) cout << a;
    cout << endl;


    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    int a,b,k;
    cin >> a >> b >> k;
    int num=a;
    for(num;num<=min(b,(a+k-1));num++) cout << num << endl;
    num=max(num,b-k+1);
    for(num;num<=b;num++) cout << num << endl;
}

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

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

    if (n == 1 && m == 1){
        cout << 1 << endl;
    }else if (n >= 3 && m == 1){
        ll ans = (n - 2) * m;
        cout << ans << endl;
    }else if (n == 2 && m == 1){
        cout << 0 << endl;
    }else if (n == 1 && m >= 3){
        ll ans = (m - 2) * n;
        cout << ans << endl;
    }else if (n == 1 && m == 2){
        cout << 0 << endl;
    } else if (n >= 3 && m >= 3){
        ll ans = n * m - (n*2 + m*2 - 4);
        cout << ans << endl;
    }else{
        cout << 0 << endl;
    }


    return 0;
}


Measured memory_bytes: 3600
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let arr:Vec<u64> = (0..5).map(|_| read()).collect();
    let ans = (n as f64 / *arr.iter().min().unwrap() as f64).ceil() + 4.0;
    println!("{}", ans);

}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;

public class Pg
{
    static void Main()
    {
        var rd = new Reader();
        rd.Read().ToList().ForEach(delegate (List<int> x)
        {
            if (x[0] < 31 || (x[0] == 31 && x[1] < 5))
            {
                Console.WriteLine("HEISEI {0}", string.Join(" ", x));
            }
            else
            {
                x[0] -= 30;
                Console.WriteLine("? {0}", string.Join(" ", x));
            }
        });
    }
}
class Reader
{
    internal IEnumerable<List<int>> Read()
    {
        string n;
        while ((n = Console.ReadLine()) != "#")
        {
            var lst = n.Split().ToList();
            lst.Remove(lst.FirstOrDefault());
            yield return lst.Select(int.Parse).ToList();
        }
    }
}



Measured memory_bytes: 18516
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <bitset>
 

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    // std::cout << std::fixed << std::setprecision(10);
    
    int n, m; std::cin >> n >> m;
    std::vector<std::pair<int, int>> cond;

    for(int i=0; i<m; i++)
    {
        int s, c; std::cin >> s >> c;
        cond.push_back(std::make_pair(s, c));
    }
    
    int ans = -1;
    for(int now=1000; now>=0; now--)
    {
        std::string s = std::to_string(now);
        bool ok = true;

        if(s.size()!=n) ok = false;
        for(int i=0; i<m; i++)
        {
            if(s[cond[i].first - 1] != (char)('0' + cond[i].second)) ok = false;
        }
        if(ok) ans = now;
    }

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

Measured memory_bytes: 256
#include<stdio.h>

#define abs(OPR) ((OPR) < 0 ? -(OPR) : (OPR))

int main(void){
    register int i,j;
    int x,n;
    scanf("%d%d",&x,&n);
    int p[n];
    for(i = 0;i < n;i++)scanf("%d",&p[i]);
    int tdw,tup;
    for(tup = x;tup <= 101;tup++){
        for(j = 0;j < n;j++)if(p[j] == tup)goto cont1;
        break;
        cont1:;
    }
    for(tdw = x;tdw >= 0;tdw--){
        for(j = 0;j < n;j++)if(p[j] == tdw)goto cont2;
        break;
        cont2:;
    }
    printf("%d",abs(x-tdw) <= abs(x-tup) ? tdw : tup);
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

vector<int>v;

void solve(string s,int len){
	if(len==s.size()){
		int k = stoll(s);
		v.push_back(k);
		return ;
	}
	for(int j = max(0,s.back()-'0'-1);j<=min(9,s.back()-'0'+1);j++){
		string t = s;
		char c = j+'0';
		t.push_back(c);
		solve(t,len);
	}
}

int32_t main(){
	fastio();
	for(int i=1;i<=10;i++){
		for(int j=1;j<=9;j++){
			string s;
			char c = j+'0';
			s.push_back(c);
			solve(s,i);
		}
	}
	sort(all(v));
	int k;
	cin>>k;
	cout<<v[k-1];
}

Measured memory_bytes: 5276
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>

#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>

#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)

using namespace std;

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

template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

struct __scanner__{ bool e; operator bool(){ return e; } } IN = { false };
inline __scanner__& operator>>(__scanner__& in,int &n)
{ in.e = scanf("%d",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,ll &n)
{ in.e = scanf("%lld",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,double &n)
{ in.e = scanf("%lf",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,char &n)
{ in.e = scanf(" %c",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,string &n) // BUFFER SIZE!
{ static char buf[1000000]; in.e = scanf(" %s",buf)==1; n = buf; return in; } 

struct State { int w, s; };

int main(){
  int a, b, c, d, e, f;
  while (cin >> a >> b >> c >> d >> e >> f) {
    static bool v[3200][3200];
    REP(i,f + 1) REP(j, f + 1) v[i][j] = false;
    queue<State> qu;
    for (qu.push((State){ 0, 0 }); qu.size(); ) {
      State st = qu.front(); qu.pop();
      if (st.w + st.s > f) continue;
      if (v[st.w][st.s]) continue;
      v[st.w][st.s] = true;
      qu.push((State) { st.w + 100 * a, st.s });
      qu.push((State) { st.w + 100 * b, st.s });
      qu.push((State) { st.w, st.s + c });
      qu.push((State) { st.w, st.s + d });
    }

    State best = { 100 * a, 0 };
    REP(i,f + 1) REP(j, f + 1) if (v[i][j] && i * e >= j * 100) {
      if (best.s * (i + j) < j * (best.s + best.w)) {
	best = (State) { i, j };
      }
    }
    cout << best.w + best.s << ' ' << best.s << endl;
  }
}


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;

void merge (int *first1, int *last1, int *first2, int *last2){
    int size1 = last1 - first1;
    int size2 = last2 - first2;
    int *result = new int[size1+size2];
    int i = 0;
    int j = 0;
    int index = 0;
    while (true){
        if (i < size1 && (first1[i] <= first2[j] || j >= size2)){
            result[index] = first1[i];
            ++i; ++index;
        }
        if (j < size2 && (first1[i] > first2[j] || i >= size1)){
            result[index] = first2[j];
            ++j; ++index;
        }
        if (i==size1 && j==size2){
            for (i=0; i<size1; ++i) first1[i] = result[i];
            for (j=0; j<size2; ++j) first2[j] = result[j+size1];
            delete[] result;
            return;
        }
    }
}
void MergeSort (int *first, int *last){
    int size = last - first;
    if(size <= 1) return;
    MergeSort(first, first+size/2);
    MergeSort(first+size/2, last);
    merge(first, first+size/2, first+size/2, last);
}


int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

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

    int R0, W0, C, R, X;
    double Y;

    while(1){
      cin >> R0 >> W0 >> C >> R;
      if(R0==0 && W0 == 0 && C == 0 && R == 0) break;
      X=0;
      while(1){
        if((R0+X*R)/C-W0*1.0 >= 0.0) break;
        X++;
      }
      cout << X << endl;
    }
    return 0;
}

Measured memory_bytes: 3124
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
 
struct node{
    int index,prev,speed;
    double cost;
    node(int index,int prev,int speed,double cost):index(index),prev(prev),speed(speed),cost(cost){}
    bool operator<(const node& other)const{
        return cost>other.cost;
    }
};
const double MAX=INT_MAX/10;
const double NONE=-1;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
 
int main(){
    cout.precision(16);
    int n,m;
    while(cin>>n>>m,n){
        int s,g;
        cin>>s>>g;
        vvi dist(n,vi(n,NONE));
        vvi limit(n,vi(n,NONE));
        REP(i,m){
            int x,y,d,c;
            cin>>x>>y>>d>>c;
            dist[x-1][y-1]=d;
            dist[y-1][x-1]=d;
            limit[x-1][y-1]=c;
            limit[y-1][x-1]=c;
        }
         
        priority_queue<node> q;
        q.push(node(s-1,s-1,0,0));
        vvvd cost(n,vvd(n,vd(31,MAX)));
        cost[s-1][s-1][0]=0;
        while(!q.empty()){
            node cnode=q.top();q.pop();
            if(cost[cnode.index][cnode.prev][cnode.speed]<cnode.cost){
                continue;
            }
            REP(i,n){
                if(i!=cnode.index&&dist[cnode.index][i]!=NONE&&i!=cnode.prev){
                    for(int ds=-1;ds<=1;ds++){
                        int newspeed=cnode.speed+ds;
                        if(newspeed>0&&newspeed<=limit[cnode.index][i]){
                            double newcost=cnode.cost+(double)dist[cnode.index][i]/newspeed;
                            if(cost[i][cnode.index][newspeed]>newcost){
                                cost[i][cnode.index][newspeed]=newcost;
                                q.push(node(i,cnode.index,newspeed,newcost));
                            }
                        }
                    }
                }
            }
        }
        double ans=MAX;
        REP(prev,n){
            ans=min(ans,cost[g-1][prev][1]);
        }
        if(ans==MAX){
            cout<<"unreachable"<<endl;
        }else{
            cout<<ans<<endl;
        }
    }
}

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

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

    int x = (n < 2 ? 0 : (n * (n - 1)) / 2);
    int y = (m < 2 ? 0 : (m * (m - 1)) / 2);

    cout << (x + y);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll                      long long int
#define i(a,n)                  int a=n
#define l(a,n)                  ll a=n
#define d(a,n)                  double a=n
#define s(a)                    string a
#define c(a)                    ll a, cin>>a
#define cd(a)                   double a, cin>>a
#define cs(a)                   string a, cin>>a
#define ci(a)                   cin>>a
#define co(a)                   cout<<a
#define cos(a)                  cout<<a<<" ";
#define con(a)                  cout<<a<<endl
#define yes                     cout<<"YES"<<endl
#define no                      cout<<"NO"<<endl
#define nl                      cout<<endl
#define ca(arr,n)               for(ll i=0;i<n;i++) cin>>arr[i]
#define f0(i,a,n)               for(ll i=a;i>=n;i--)
#define f(i,n)                  for(ll i=0;i<n;i++)
#define f1(i,a,n)               for(ll i=a;i<n;i++)
#define T                       ll t=1; cin>>t; while(t--)
#define lcm(a,b)                (a*b)/__gcd(a,b)
#define fast                    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ret(x)                  return cout<<x,0;
 
using namespace std;
 
int main()
{
    fast;
    ll x,k=1;
  	cin>>x;
  	while (k * x % 360 != 0) k++;
  	cout <<k;
    return 0;
}
 
/*It's not who I am underneath, but what I do that defines me
 
MMMMMMMMMMMMMMMMMMMMM.                             MMMMMMMMMMMMMMMMMMMMM
 `MMMMMMMMMMMMMMMMMMMM           M\  /M           MMMMMMMMMMMMMMMMMMMM'
   `MMMMMMMMMMMMMMMMMMM          MMMMMM          MMMMMMMMMMMMMMMMMMM'
     MMMMMMMMMMMMMMMMMMM-_______MMMMMMMM_______-MMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
     .MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.
    MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
                   `MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM'
                          `MMMMMMMMMMMMMMMMMM'
                              `MMMMMMMMMM'
                                 MMMMMM 
                                  MMMM
                                   MM
*/

Measured memory_bytes: 3588
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }
 
    void solve (){
        int n;
        cin>>n;
        vector<int>a(n);
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            --x;
            a[x]=i+1;
        }
        for(auto i : a)
            cout<<i<<" ";
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

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

using namespace std;

typedef pair<int, int> P;

int n;

vector<int> sfl(vector<int> v, int k) {
	vector<int> ret;

	if (k == 0) {
		for (int i = 0; i < n; ++i) {
			ret.push_back(v[i]);
			ret.push_back(v[n+i]);
		}
	}
	else {
		for (int i = k; i < 2*n; ++i)
			ret.push_back(v[i]);

		for (int i = 0; i < k; ++i)
			ret.push_back(v[i]);
	}

	return ret;
}

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

	vector<int> v;
	for (int i = 1; i <= 2*n; ++i)
		v.push_back(i);

	for (int i = 0; i < m; ++i) {
		int k;
		cin >> k;
		v = sfl(v, k);
	}

	for (int i = 0; i < v.size(); ++i)
		cout << v[i] << endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; ++i)
#define rep(i,n) for(int i = 1; i <= n; ++i)
#define boost ios::sync_with_stdio(0)
#define ms0(s) memset((s), 0, sizeof(s))
#define INF 0x3f3f3f3f
#define ABS(x) ((x)<0 ? (-(x)) : (x))
#define forvec(it,v) for(vector<int>::iterator it = v.begin(); it != v.end(); ++it)
 
#ifdef LOCAL
#define DEBUG 1
#else
#define DEBUG 0
#endif
#define $ if(DEBUG)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template <typename T>
inline void read(T& x){
	int w = 1; T data = 0;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-') ch = getchar();
	if(ch == '-') w = -1, ch = getchar();
	while(isdigit(ch))
		data = 10 * data + ch - '0', ch = getchar();
	x = data * w;
}
const int maxn = 210;
char s[maxn], t[maxn];
int main()
{
	scanf("%s%s", s, t);
	int lens = strlen(s);
	for(int i = lens; i < lens* 2; ++i) s[i] = s[i - lens];
	for(int j = 0; j < lens; j++){
		int ok = 1;
		for(int k = 0; k < lens; k++)
			if(s[j+k] != t[k]) {ok = 0; break;}
		if(ok) return puts("Yes"),0;
	} 
	puts("No");
	return 0;
}

Measured memory_bytes: 256