akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for(auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n + 1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for(auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for(auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for(auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int>> name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num)) + 1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)                                                                                                          \
  cerr << "[";                                                                                                         \
  REPI(itr, v) { cerr << *itr << (itr != --v.end() ? ", " : ""); }                                                     \
  cerr << "]" << endl;
#define dpa(v)                                                                                                         \
  cerr << "[ " << endl;                                                                                                \
  REPI(itr, v) {                                                                                                       \
    cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl;            \
  }                                                                                                                    \
  cerr << "]" << endl;

void solve(long long A, long long B, long long H, long long M) {
  double preTheta = abs((30 * H + 1 / 2.0 * M) - 6 * M);
  double theta = min(preTheta, 360 - preTheta);
  // cout << sqrt(A * A + B * B - 2 * A * B * cos(M_PI * theta / 180)) << endl;
  printf("%.9lf\n", sqrt(A * A + B * B - 2 * A * B * cos(M_PI * theta / 180)));
}

signed main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long H;
  scanf("%lld", &H);
  long long M;
  scanf("%lld", &M);
  solve(A, B, H, M);
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>pos;
      rep(i,n)cin>>a[i];
      ll mi=INF,ma=0;
      rep(i,n){
        if(mi>a[i])mi=a[i];
        else{
          if(ma<a[i]-mi){
          ma=a[i]-mi;
          ans=1;
          }
          else if(ma==a[i]-mi)ans++;
        }
        //cout<<mi<<" "<<a[i]<<"\n";
      }
      Cout(ans);

       
return 0;
}


Measured memory_bytes: 1024
//
// Created on 2020/05/30.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    string s;
    cin>>s;

    bool ok = false;
    int ans = 0;
    int cnt = 0;
    vector<char>atgt = {'A','C','G','T'};
    for (int i = 0; i < s.size(); ++i) {
        bool find = false;
        for (auto c : atgt) {
            if(s[i] == c && ok){
                cnt ++;
                ans = max(ans,cnt);
                find = true;
                break;
            }else if(s[i] == c && !ok){
                ok = true;
                cnt ++;
                ans = max(ans, cnt);
                find = true;
                break;
            }
        }
        if(!find && ok){
            ok = false;
            cnt = 0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
'use strict';

const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split(" ");
const a = lines[0];
const b = lines[1];
const c = lines[2];

if (a===b && b===c) {
  console.log(1);
}
if (a===b && b!==c) {
  console.log(2);
}
if (a===c && a!==b) {
  console.log(2);
}
if (b===c && a!==b) {
  console.log(2);
}
if (a!==b && b!==c && c!==a) {
  console.log(3);
}

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
bitset<2000006>bit;
int main(void)
{
    int n;
    scanf("%d",&n);
    bit.set(0);
    int sum = 0;
    for(int i = 0;i < n;i++)
    {
        int s;
        scanf("%d",&s);
        sum += s;
        bit|=bit<<s;
    }
    for(int i = (sum + 1)/2;i < 2000006;i++)
    {
        if(bit[i])
        {
          printf("%d\n",i);
          break;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int n;
vector<vector<int>> g(10);
int sum=0;

void solve(int u,vector<bool> memo){
  memo[u]=1;
  bool f=0;
  rep(i,n){
    if(!(memo[i])) f=1;
  }
  if(f){
    rep(i,g[u].size()){
      int v=g[u][i];
      if(!memo[v]) solve(v,memo);
    }
  }else sum++;
}

int main(){
  int m; cin>>n>>m;
  rep(i,m){
    int a,b; cin>>a>>b;
    a--; b--;
    g[a].pb(b); g[b].pb(a);
  }
  vector<bool> k(n,0);
  solve(0,k);
  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define out(x) std::cout << (x) << std::endl
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int mini, cnt = 1;
    cin >> mini;
    rep(i, n - 1) {
        int p;
        cin >> p;
        if (p <= mini) {
            cnt++;
            mini = p;
        }
    }
    out(cnt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ls rt << 1
#define rs rt << 1 | 1
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second
#define pii pair<int, int>
#define pcc pair<char, char>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
#define ALL(x) (x).begin(), (x).end()
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int main()
{
	string a;
	cin >> a;
	int n = a.size() ;
	rep(i, 0, n - 2)
		if(a[i] == 'A' && a[i + 1] == 'C') 
		{
			puts("Yes");
			return 0;
		}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
/*
 * a.cc:
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
#include<iomanip>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */
int main(){
  int x,y;
  cin>>x>>y;

  cout<<x+y/2<<endl;
  
}
  

  


Measured memory_bytes: 3584
import collections
import itertools
t=[]
while True:
    try:
        k=int(input())
        t.append(k)
        
    except EOFError:
        break
    
counter=collections.Counter(t)
mode_v=counter.most_common()[0][-1]
it=itertools.takewhile(lambda kv:kv[-1]==mode_v,counter.most_common())
m=(k for k,v in it)
[print(i) for i in m]


Measured memory_bytes: 6020
N,M,K=map(x->parse(Int,x),split(readline()))
O=10^9+7
S=N+M
T=6
for i=1:K
	S=S*(N*M-i+1)%O
	T=T*i%O
end
p(a,b)=b>0 ? p(a*a%O,div(b,2))*(b%2>0 ? a : 1)%O : 1
println(S*K%O*(K-1)%O*p(T,O-2)%O)


Measured memory_bytes: 142336
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i)

arr = []
a_arr.each_with_index do |a, i|
  arr << [a, i+1]
end

arr2 = []
arr.sort_by{|(k, v)| k}.each do |(k, v)|
  arr2 << v
end

puts arr2.join(" ")


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i];
    }
    int pos = 0;
    while (pos < n && 2 * pos + 1 <= x[pos])
    {
        pos++;
    }
    ll ret = (pos == n ? n : pos + 1);
    for (int i = 1; i < n; i++)
    {
        // i個処理済み
        while (pos < n && 2 * (pos - i) + 1 <= x[pos])
        {
            pos++;
        }
        ret *= (pos == n ? n - i : pos - i + 1);
        ret %= MOD;
    }
    cout << ret << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    int p, wrong_cnt[N]={0}, AC_flag[N]={0};
    string S;
    for(int i=0; i<M; i++){
        cin >> p >> S;
        if( !AC_flag[p-1] && S=="WA" ){
            wrong_cnt[p-1]++;
        }else{
            AC_flag[p-1]=1;
        }
    }
    int ACsum=0,WAsum=0;
    for(int i=0; i<sizeof(AC_flag)/sizeof(*AC_flag);i++){
        ACsum+=AC_flag[i];
        if( AC_flag[i] ){
            WAsum+=wrong_cnt[i];
        }
    }
    cout << ACsum << " " << WAsum << endl; 
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int operand(int first, int second, int op) {
  if (op == 0) {
    return first + second;
  } else {
    return first - second;
  }
}
char op(int operat) {
  if (operat == 0) {
    return '+';
  } else {
    return '-';
  }
}

int main(int argc, char const *argv[]) {
  char s[5];
  cin >> s;
  int A = s[0] - '0';
  int B = s[1] - '0';
  int C = s[2] - '0';
  int D = s[3] - '0';
  for (int op1 = 0; op1 < 2; op1++) {
    for (int op2 = 0; op2 < 2; op2++) {
      for (int op3 = 0; op3 < 2; op3++) {
        if (operand(operand(operand(A, B, op1), C, op2), D, op3) == 7) {
          cout << A << op(op1) << B << op(op2) << C << op(op3) << D << "=7"<<endl;
          return 0;
        };
      }
    }
  }
  return 0;
}


Measured memory_bytes: 764
N = int(input())
ans = [0]*(N+1)
for x in range(1,100):
    xx = x*x
    for y in range(1,100):
        yy = y*y
        xy = x*y
        for z in range(1,100):
            zz = z*z
            zx = z*x
            yz = y*z
            n = xx+yy+zz+xy+yz+zx
            if n<=N: ans[n]+=1

for n in range(1,N+1):
    print(ans[n])


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

#define rep(i, n) for(int i = 0; i < (n); ++i)

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}

// mod. m での a の逆元 a^{-1} を計算する
long long inv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

    ll N = mod_pow((ll)2, (ll)n, (ll)MOD);

    ll ans = N - 1;
    if (ans < 0) ans += MOD;
    
    ll res = 1;
    ll A = 1;
    for (int i = 1; i <= a; ++i) {
        res *= n - (i - 1);
        res %= MOD;
        A *= i;
        A %= MOD;
    }

    ans -= res * inv(A, MOD) % MOD;
    ans %= MOD;
    if (ans < 0) ans += MOD;

    res = 1;
    ll B = 1;
    for (int i = 1; i <= b; ++i) {
        res *= n - (i - 1);
        res %= MOD;
        B *= i;
        B %= MOD;
    }

    ans -= res * inv(B, MOD) % MOD;
    ans %= MOD;
    if (ans < 0) ans += MOD;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1e5+5;

int fat[1005];


int main() {
	ll a, b, n;
	cin >> a >> b >> n;
	
	ll k = min(n, b-1);

	ll p1 = (a*k)/b, p2 = a * (k/b);
	
	cout << p1 - p2 << endl;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;


int main()
{
	string s; cin >> s;

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
		cout << "Bad" << endl;
	else
		cout << "Good" << endl;
}


Measured memory_bytes: 256
package main
import "fmt"
func main(){
  var x, n , i int
  fmt.Scan(&n, &x)
  a:=make([]int,n)
  for  i=0;i<n;i++ {
    fmt.Scan(&a[i])
  }
  cont:=0
  ans:=1
  for i=0;i<n;i++{
    cont+=a[i]
    if cont<=x {
      ans++
    }
  }
  fmt.Println(ans)
}


Measured memory_bytes: 512
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		int[][] s = new int[M][N];

		for (int i = 0; i < M; i++) {
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				int num = sc.nextInt()-1;
				s[i][num] = 1;
			}
		}

		int[] p = new int[M];
		for (int i = 0; i < M; i++) {
			p[i] = sc.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < 1 << N; i++) {
			boolean flg = true;
			// bit全探索の全通りのloop
			int[] A = new int[N];
			for (int j = 0; j < N; j++) {
				if ((1 & i >> j) == 1) {
					A[j] = 1;
				}
			}

			for (int k = 0; k < M; k++) {
				int sum = 0;
				for (int l = 0; l < N; l++) {
					sum = sum + s[k][l] * A[l];
				}
				if (sum%2 != p[k]) {
					flg = false;
				}
			}
			if (flg == true) {
				ans++;
			}
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 36976
#include<iostream>	// 入出力
#include<stdio.h>	// printf()が使える小数は%fで
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか


using namespace std;

int main()
{
	int N; cin >> N;
	int P; cin >> P;

	int ki = 0, gu = 0;

	for (int i = 0; i < N; ++i)
	{
		int A; cin >> A;

		if (A % 2 == 0) { ++gu; }
		else { ++ki; }
	}

	long long int ans = 1;

	if (P == 0)
	{
		for (int i = 0; i < gu; ++i)
		{
			ans *= 2;
		}

		int psum = 0;
		for (int i = 0; i <= ki; i += 2)
		{
			int p = 1;
			for (int j = 1; j <= i; ++j)
			{
				p = p*(ki - j + 1) / j;
			}
			psum += p;
		}
		ans *= psum;
	}
	else
	{
		for (int i = 0; i < gu; ++i)
		{
			ans *= 2;
		}
		int psum = 0;
		for (int i = 1; i <= ki; i += 2)
		{
			int p = 1;
			for (int j = 1; j <= i; ++j)
			{
				p = p*(ki - j + 1) / j;
			}
			psum += p;
		}
		ans *= psum;
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;
static const int INF = 1e9;
typedef pair<int, int> P;
struct edge
{
	int to;
	int cost;
};
int d[101];
vector<edge> G[101];

void solve()
{
	int n, k;
	while (cin >> n >> k, n || k)
	{
		for (int i = 0; i < 101; ++i)
		{
			G[i].clear();
		}
		priority_queue<P, vector<P>, greater<P> > pque;
		for (int i = 0; i < k; ++i)
		{
			int order;
			cin >> order;
			if (order == 0)
			{
				int start, end;
				cin >> start >> end;
				for (int j = 0; j <= n; ++j)
				{
					d[j] = INF;
				}
				d[start] = 0;
				pque.push(P(0, start));
				while (!pque.empty())
				{
					P p = pque.top();
					pque.pop();
					int v = p.second;
					if (d[v] < p.first)
					{
						continue;
					}
					for (int j = 0; j < G[v].size(); ++j)
					{
						edge e = G[v][j];
						if (d[e.to] > d[v] + e.cost)
						{
							d[e.to] = d[v] + e.cost;
							pque.push(P(d[e.to], e.to));
						}
					}
				}
				if (d[end] == INF)
				{
					cout << -1 << endl;
				}
				else
				{
					cout << d[end] << endl;
				}
			}
			else
			{
				int from, to, cost;
				cin >> from >> to >> cost;
				edge e1, e2;
				e1.to = to;
				e1.cost = cost;
				e2.to = from;
				e2.cost = cost;
				G[from].push_back(e1);
				G[to].push_back(e2);
			}
		}
	}
}

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

Measured memory_bytes: 1256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
  string s;cin>>s;
  char ans;
  ans=s[0]+1;
  cout<<ans<<endl;
}

Measured memory_bytes: 888
// Shinchan Loves Coding :)))
#include<bits/stdc++.h>
#include<map>
#include<set>
#include<stack>

using namespace std;

#define night_rider ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define double long double
#define en "\n"
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define toUpper(x) transform(x.begin(), x.end(), x.begin(),::toupper);
#define toLower(x) transform(x.begin(), x.end(), x.begin(),::tolower);
#define rep(i,x,y) for(int i=x ; i<y ; i++)
#define erep(i,x,y) for(int i=x ; i<=y ; i++)
#define erepr(i,x,y) for(int i=x ; i>=y ; i--)
#define repr(i,x,y) for(int i=x ; i>y ; i--)
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> pii;
bool secdes(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi>b.fi;}else{return a.se>b.se;}}//second descending !
bool sir(const pair<int,int>&a , const pair<int,int>&b){if(a.fi==b.fi){return a.se>b.se;}else{return a.first>b.first;}}//first descending !
bool bysec(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi<b.fi;} else{return a.se<b.se;}}//second ascending !

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

const int no=1e6+1;
const int modulo=1e9+7;
const int inf=1e18;
const int N=2001;
int ar[no],br[no],mat[N][N];
int dx[]={-1 , 0 , 1 , 0};
int dy[]={0 , 1 , 0 , -1};
char dc[]={'L', 'D' , 'R' ,'U'};

//--------------------------------------------------------------------------------------------------------------------------------------------------------------
int mul(int x , int y , int mod) {
	return ((x%mod)*(y%mod))%mod;
}

int powwmod(int x, int y , int mod) { int res=1; while (y) { if (y & 1){ y--; res=mul(res,x,mod); res%=mod; } else { y/=2; x=mul(x,x,mod); x%=mod; } } return res%mod; }

int poww(int x , int y) { int res=1; while(y) { if(y%2) { y--; res=res*x; } else { y/=2; x=x*x; } } return res; }

int div(int x , int y , int mod) {
	return x*poww(y,mod-2)%mod ;
}

bool comp(int x, int y) {
	return (x < y);   // MAXIMUM
	return (x > y);   // MINIIMUM
}

int gcd(int x, int y) { if(y==0) return x; else return gcd(y,x%y); }

int lcm(int x, int y) { return (x*y)/gcd(x,y);}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------
vi adj[no];
int used[no];

void solve (){
	int n=0,m=0,a=0,b=0,x=0,y=0,z=0,w=0,k=0;
	cin>>n;
	for (int i = 1; i <= n; i++) {
        for (int j = 1; j * i <= n; j++)
            ar[i * j]++;
     }
     int ans=0;
	rep(i,1,n) {
		ans+=ar[n-i];
	}
	cout<<ans<<en;
}

inline void runn(){
	#ifndef ONLINE JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

signed main()
{
	night_rider
	//runn();
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 34836
N, M = map(int,input().split())
H = [int(h) for h in input().split()]
A = [0] * M
B = [0] * M
for i in range(M):
  A[i], B[i] = map(int, input().split())

count = ['good'] * N
for i in range(M):
  if H[A[i] - 1] < H[B[i] - 1]:
    count[A[i] - 1] = 'bad'
  elif H[A[i] - 1] > H[B[i] - 1]:
    count[B[i] - 1] = 'bad'    
  elif H[A[i] - 1] == H[B[i] - 1]:
    count[A[i] - 1] = 'bad'
    count[B[i] - 1] = 'bad'
  
print(count.count('good'))


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

const int N = 100050;

int n, m;
vector<int> G[N];
bool del[N];

int find(int u) {
	while(!G[u].empty()) {
		int v = G[u].back(); G[u].pop_back(); if (del[v]) continue;
		return v;
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	while(m--) {
		int u, v; cin >> u >> v;
		G[u].push_back(v); G[v].push_back(u);
	}
	del[1] = 1;
	deque<int> q; q.push_back(1);

	while(true) {
		int u, v;
		u = q.front();
		v = find(u);
		if (v != 0) { del[v] = 1; q.push_front(v); continue; }

		u = q.back();
		v = find(u);
		if (v != 0) { del[v] = 1; q.push_back(v); continue; }
		break;
	}

	printf("%d\n", (int)q.size());
	while(!q.empty()) {
		int u = q.front(); q.pop_front();
		printf("%d ", u);
	}
	printf("\n");
}

Measured memory_bytes: 6784
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
	cerr << "Compilation Done." << '\n';
	string s;
	cin >> s;
	if(s.size() == 6 && s[2] == s[3] && s[4] == s[5]) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int result = 0;
        int lowwer = 0;
        int upper = 0;

        if (a >= c) {
            lowwer = a;
        } else {
            lowwer = c;
        }

        if (b <= d) {
            upper = b;
        } else {
            upper = d;
        }

        if (upper >= lowwer) {
            result = upper - lowwer;
        }

        System.out.println(result);
    }
}

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

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

  int X, A, B;
  cin >> X >> A >> B;
  if(B-A <= 0){
    cout << "delicious" << endl;
  }
  else if(B-A <= X){
    cout << "safe" << endl;
  }
  else{
    cout << "dangerous" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int w, h;
string c[22];
int dist[22][22];

vector<pair<int, int>> G[22];
vector<pair<int, int>> gomi;


void solve(pair<int, int> s) {
	rep(i, 22)rep(j, 22) dist[i][j] = INF;
	dist[s.fi][s.se] = 0;
	queue<pair<int, int>> q;
	q.push(mp(s.fi, s.se));
	while(!q.empty()){
		auto y = q.front().fi, x = q.front().se;
		q.pop();
		rep(k, 4) {
			int ny = y + dy[k], nx = x + dx[k];
			if(!(0 <= ny && ny < h && 0 <= nx && nx < w)) continue;
			if(dist[ny][nx] != INF) continue;
			if(c[ny][nx] == 'x') continue;
			dist[ny][nx] = dist[y][x] + 1;
			q.push(mp(ny, nx));
		}
	}
}


int dp[(1<<22)][22];
void bitdp(int n, int sy, int sx) {
	rep(i, (1<<n))rep(j, n) dp[i][j] = INF;
	solve(make_pair(sy, sx));
	rep(i, n){
		dp[(1<<i)][i] = dist[gomi[i].fi][gomi[i].se];
	}

	for (int mask = 1; mask < (1<<n); ++mask) {
		for (int u = 0; u < n; ++u) {
			for (auto t : G[u]) {
				auto v = t.fi, cost = t.se;
				if(dp[mask][u] == INF) continue;
				if((mask & (1<<u)) == 0) continue;
				if((mask & (1<<v))) continue;
				chmin(dp[mask | (1<<v)][v], dp[mask][u] + cost);
			}
		}
	}
}


int main(void) {
	while(1) {
		scanf("%d %d", &w, &h);
		if(w == 0 && h == 0) break;
		rep(i, h) cin >> c[i];

		rep(i, 22) G[i].clear();
		gomi.clear();
		
		rep(y, h)rep(x, w) if(c[y][x] == '*') gomi.pb(mp(y, x));
		int sy, sx;
		rep(y, h) rep(x, w) if(c[y][x] == 'o') sy = y, sx = x;
		int n = gomi.size();

		rep(i, gomi.size()) {
			auto u = gomi[i];
			solve(u);
			reps(j, i + 1, gomi.size()) {
				auto v = gomi[j];
				auto di = dist[v.fi][v.se];
				G[i].pb(mp(j, di)), G[j].pb(mp(i, di));
			}
		}

		bitdp(n, sy, sx);
		ll ret = INF;
		rep(i, n) chmin(ret, dp[(1<<n) - 1][i]);
		if(ret != INF) printf("%lld\n", ret);
		else printf("-1\n");
	}
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    
    if (a == 1) a = 14;
    if (b == 1) b = 14;
    
    if (a == b) cout << "Draw" << endl;
    else cout << (a > b ? "Alice" : "Bob") << endl;
    
}


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

int main(){
  int n, k;
  cin >> n >> k;
  int sum = 0;
  for (int i = 0;i < n;i++) {
    int x;
    cin >> x;
    int a = 0;
    if(x >= k) a = x - k;
    else a = k - x;
    if(x >= a){
      sum += (a * 2);
    }
    else sum += (x * 2);
  }
  cout << sum << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	ll num, i, ans;
	cin >> num;
	ans = 1000ll * (num / 500);
	num %= 500;
	ans += 5 * (num / 5);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define Mod 1000000007

void merge_sort(int x[], int n)
{
	static int y[1001] = {};
	if (n <= 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p] < x[q])? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

int main()
{	
	int i, N, M, A[1001], B[1001];
	scanf("%d %d", &N, &M);
	for (i = 0; i < N; i++) scanf("%d", &(A[i]));
	for (i = 0; i < M; i++) scanf("%d", &(B[i]));
	merge_sort(A, N);
	merge_sort(B, M);
	
	int j, n, b;
	long long ans = 1;
	for (n = N * M, i = N - 1, j = M - 1, b = 0; n >= 1; n--) {
		if ((i < 0 || A[i] < n) && (j < 0 || B[j] < n)) {
			if (b == 0) break;
			else ans = ans * (b--) % Mod;
		}
		if (i >= 0 && A[i] == n && j >= 0 && B[j] == n) {
			b += N - i - 1 + M - j - 1;
			i--;
			j--;
		} else if (i >= 0 && A[i] == n) {
			if (j == M - 1) break;
			else ans = ans * (M - j - 1) % Mod;
			b += M - j - 2;
			i--;
		} else if (j >= 0 && B[j] == n) {
			if (i == N - 1) break;
			else ans = ans * (N - i - 1) % Mod;
			b += N - i - 2;
			j--;
		}
	}
	
	if (n >= 1 || i >= 0 || j >= 0) printf("0\n");
	else printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    for(int i=0; i<=5; i++) {
        if(a == i) {
            cout << 0;
        }
    }
    for(int i=6; i<=12; i++) {
        if(a == i) {
            cout << b/2;
        }
    }
    if(a>=13) {
        cout << b;
    }
}


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int x; cin >> x;
	if (x==7) cout << "YES\n" << endl;
	else if (x==5) cout << "YES\n" << endl;
	else if (x==3) cout << "YES\n" << endl;
	else cout << "NO" << endl;
	return 0;
}


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

int main() {
	int x, y;

	std::cin >> x >> y;

	std::vector<std::string> v(x);

	for (int i = 0; i < x; i++) {
		std::cin >> v[i];
	}

	std::sort(v.begin(), v.end());

	for (int i = 0; i < x; i++) {
		std::cout << v[i];
	}

	std::cout << std::endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <iterator>
#include <sstream>
#include <bits/stdc++.h>

using ll = long long;
using namespace std;
#define modmod 1000000007
#define modddd 998244353

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)

int main(){
    int N;
    cin >> N;

    ll count = 0;
    ll num;

    for(int i = 1; i <= N; i++){
        count += i;
        if(count >= N){
            num = i;
            break;
        }
    }
    //printf("num : %d\n",num);

    vector<ll> result;
    ll count2 = 0;

    for(int i = num; i >= 1; i--){
        result.push_back(i);
        count2 += i;
        //printf("count2 : %d\n",count2);
        if(count2 > N){
            result.pop_back();
            count2 -= i;
        }
        if(count2 == N){
            break;
        }
    }

    for(int x : result){
        cout << x << endl;
    }

    return 0;

}


Measured memory_bytes: 384
def search(h, w)
  mapp = GRID.map(&:dup)
  mapp[h][w] = 0
  que = [[h, w]]
  while !que.empty?
    que_ = que.shift
    que_y, que_x = que_[0], que_[1]
    [[0,1],[1,0],[0,-1],[-1,0]].each do |y, x|
      ny, nx = que_y+y, que_x+x
      next if !ny.between?(0, H-1) || !nx.between?(0, W-1) || GRID[ny][nx] == -1
      if mapp[ny][nx] > mapp[que_y][que_x] + 1
        mapp[ny][nx] = mapp[que_y][que_x] + 1
        que << [ny, nx]
      end
    end
  end
  mapp.flatten.max
end

H, W = gets.split.map(&:to_i)
GRID = H.times.map{gets.chomp.split('').map{|str|str == "." ? H*W : -1}}
max = 0
H.times do |i|
  W.times do |j|
    next if GRID[i][j] == -1
    max = [max, search(i, j)].max
  end
end
p max

Measured memory_bytes: 1916
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    char A;
    int j;
    
    for(int i = 0; i < N; i++){
        
        cin >> A;
        
        if(A == 'Y'){
            
            j = 1;
            
            break;
            
        }
        
        else if(A != 'Y'){
            
            j = 0;
        }
        
    }
    if(j == 1){
        
        cout << "Four" << endl;
        
    }
    
    else if(j == 0){
        
        cout << "Three" << endl;
        
    }
    
}

Measured memory_bytes: 256
# ABC B - five dishes
import  math
from itertools import permutations

min_t = 100000
X = [int(input()) for i in range(5)]
for x in list(permutations(X)):
    t = 0
    for i in range(4):
        t += x[i]
        t = math.ceil(t/10)*10
    t += x[4]
    if t < min_t:
        min_t = t
print(min_t)



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

int main(void){
    int n ;
    vector<int> a,b ;
    cin >> n ;
    for (int i=0; i<n-1; i++){
        int x ;
        cin >> x ;
        b.push_back(x) ;
    }
    int ans=b[0] ;
    for (int i=0; i<n-1; i++){
        ans+=min(b[i],b[i+1]);
    }
    cout << ans+b[n-2] << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> num(3);
  cin>>num[0]>>num[1]>>num[2];
  sort(num.begin(),num.end());
  if(num[0]==5 && num[1]==5 && num[2]==7){
  	cout<<"YES"<<endl;
  }else{
  	cout<<"NO"<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7
n = int(input())
S1 = input()
S2 = input()
A = []  # 縦かどうかboolean
tmp = ""
i = 0
while i < n:
    if S1[i] == S2[i]:
        A.append(True)
        i += 1
    else:
        A.append(False)
        i += 2

l = len(A)
dp = [[0] * 2 for _ in range(l)]
if A[0]:
    dp[0][True] = 3
else:
    dp[0][False] = 6

for i in range(1, l):
    if A[i - 1]:
        if A[i]:
            dp[i][True] = dp[i - 1][True] * 2 % MOD
        else:
            dp[i][False] = dp[i - 1][True] * 2 % MOD
    else:
        if A[i]:
            dp[i][True] = dp[i - 1][False]
        else:
            dp[i][False] = dp[i - 1][False] * 3 % MOD

print(sum(dp[l - 1]) % MOD)


Measured memory_bytes: 62068
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n,k,s = LI()
    ans = []
    if s<10**9:
        ans = [s]*k + [s+1]*(n-k)
    else:
        if n == k:
            ans = [s]*n
        else:
            for i in range(n):
                if i<=k:
                    ans.append(1 if i%2==0 else s-1)
                else:
                    ans.append(2)
    print(*ans)
    
main()            


Measured memory_bytes: 85024
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		double[] arr = new double[n];
		double[] acc = new double[n + 1];
		acc[0] = 0;
		for (int i=0;i<n;i++) {
			arr[i] = sc.nextInt();
			acc[i + 1] = acc[i] + arr[i];
		}
		double [][] dp = new double[n + 1][m + 1];
		for (int i=0;i<n+1;i++) {
			for (int j=0;j<m+1;j++) {
				dp[i][j] = Integer.MIN_VALUE;
			}
		}
		dp[0][0] = 0;
		for (int i=1;i<n+1;i++) {
			for (int j=1;j<Math.min(m+1,i+1);j++) {
				for (int k=j-1;k<i;k++) {
					dp[i][j] = Math.max(dp[i][j], dp[k][j - 1] + (acc[i] - acc[k]) / (i - k));
				}
			}
		}
		System.out.printf("%.6f", dp[n][m]);
	}
}



Measured memory_bytes: 33732
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] str = br.readLine().split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);

		int count=0;
		while(a <= b){
			if(c % a == 0) count++;
			a++;
		}
		System.out.println(count);
		br.close();
	}
}

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

int main(){
    int n,y;
    cin>>n>>y;
    int a=-1,b=-1,c=-1;
    
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            if((10000*i+5000*j+1000*(n-i-j))==y){
                a=i;
                b=j;
                c=n-i-j;
            }
        }
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    
}


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

// dijkstra を用いた dp を考える
// ペタではできない(dijkstra の気持ちを本当に理解していますか?)


struct info{
    int pos;
    string str;
    info(int pos, string str):pos(pos),str(str){}
    info(){}
    bool operator<(const info& a) const{ return str > a.str; }
};

int main(){

   


    while(1){
        int n, a, s, g; cin >> n >> a >> s >> g;
        if(!n) break;
        vector<vector<pair<int, string> > > adj(n);
        for(int i = 0; i < a; i++){
            int u, v; cin >> u >> v;
            string lab; cin >> lab;
            adj[u].push_back({v, lab});
        }

        //dp[pos][len] := pos,len の時に取れる文字列の最小値
        vector<vector<string> > dp(n, vector<string> (6 * 5 * n, "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"));


        //priority queue には {str, pos} の組を入れ、strが小さい順に取り出していく。
        priority_queue<info> pq;
        pq.push(info(s, ""));
        dp[s][0] = "";
        while(!pq.empty()){
            
            int pos = pq.top().pos;
            string str = pq.top().str;
            int len = (int)str.size();
            pq.pop();
            //cout << pos << " " << str << " " << len << endl;
            if(str > dp[pos][len]) continue;

            for(auto x : adj[pos]){
                int next_pos = x.first;
                string next_str = str + x.second;
                int next_len = (int)next_str.size();
                if(next_len >= 6 * 5 * n) continue;
                if(dp[next_pos][next_len] > next_str){
                    dp[next_pos][next_len] = next_str;
                    //cout << "dp[" << next_pos << "][" << next_len << "] = " << dp[next_pos][next_len] << endl;
                    pq.push(info(next_pos, next_str));
                }
            }
        }

        string ans = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
        for(int i = 0; i < 6 * 5 * n; i++){
            ans = min(ans, dp[g][i]);
            //cout << dp[g][i] << endl;
        }

        if(ans.size() > 9 * n || ans == "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"){
            cout << "NO" << endl;
        }else{
            cout << ans << endl;
        }
    }

    return 0;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(char i='0';i<='9';i++){
        ll p = s.find(i);
        if(p == string::npos)continue;
        for(char j='0';j<='9';j++){
            ll q = s.find(j, p+1);
            if(q == string::npos)continue;
            for(char k='0';k<='9';k++){
                ll r = s.find(k,q+1);
                if(r == string::npos)continue;
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
vector<long int>V;
long int h;
for(int i=0;i<10;i++){
    scanf("%ld",&h);
    V.push_back(h);
}
sort(V.begin(),V.end());
for(int i=9;i>6;i--){
    printf("%ld\n",V[i]);
}

return 0;
}

Measured memory_bytes: 1212
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ok = True
        for k in range(N):
            if i == k or j == k:
                continue
            if A[i][j] > A[i][k] + A[k][j]:
                print(-1)
                exit(0)
            elif A[i][j] == A[i][k] + A[k][j]:
                ok = False
        if ok:
            ans += A[i][j]

print(ans)


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

int main(){
    int N;
    std::cin >> N;
    std::vector< int > A(N);
    for(int i=0; i<N;i++){
        std::cin >> A[i];
    }
    
    bool F = true;
    for(int i=0; i<N;i++){
        if(A[i] % 2 == 0){
            if(! (A[i] % 3 == 0 || A[i] % 5 == 0) ){
                F = false;
             }
         }
    }
    
    if(F){
        std::cout << "APPROVED" << std::endl;
    }else{
        std::cout << "DENIED" << std::endl;
    }
}


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

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

    int n, ans = 0;
    cin >> n;

    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];

    rep(i, 0, n - 2)
    {
        vector<int> x;
        rep(j, 0, 3) x.push_back(a[i + j]);
        sort(x.begin(), x.end());
        if (a[i + 1] == x[1])
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

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

func Swap(a []int, b, e, t int) {
	for k := 0; k < e-b; k++ {
		a[b+k], a[t+k] = a[t+k], a[b+k]
	}
}

func NextInt(sc *bufio.Scanner) int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := NextInt(sc)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = NextInt(sc)
	}

	q := NextInt(sc)
	for i := 0; i < q; i++ {
		Swap(a, NextInt(sc), NextInt(sc), NextInt(sc))
	}
	fmt.Println(strings.Trim(fmt.Sprint(a), "[]"))
}



Measured memory_bytes: 1244
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。

for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}

*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/


/*実行開始からの経過時間を表すよ。

while (clock() < 1900000) {  }

*/


/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/


/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/

int main() {

	int n, m;

	while (1) {
		cin >> n >> m;
		if (n == 0 && m == 0) { return 0; }

		int taro[100], hanako[100];
		int taro_sum = 0, hanako_sum = 0;

		for (int i = 0; i < n; i++) {
			cin >> taro[i];
			taro_sum += taro[i];
		}

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


		int ans_taro = 200, ans_hanako = 200;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if ((hanako_sum - hanako[j] + taro[i]) == (taro_sum - taro[i] + hanako[j])) {
					if (ans_taro + ans_hanako > taro[i] + hanako[j]) {
						ans_taro = taro[i];
						ans_hanako = hanako[j];
					}
				}
			}
		}

		if (ans_taro == 200 && ans_hanako == 200) { cout << "-1" << endl; }
		else {
			cout << ans_taro << " " << ans_hanako << endl;
		}


	}

	return 0;
}



Measured memory_bytes: 3004
N = int(input())

D = {}
q = set()
for i in range(N):
    s,p = input().split()
    if s in q:
        D[s].append([int(p),i])
    else:
        D[s] = [[int(p),i]]
        q.add(s)

ans = []
for i in sorted(list(q)):
    D[i].sort(reverse=True)
    for j in D[i]:
        ans.append(j[1])

[print(i+1) for i in ans]


Measured memory_bytes: 8992