akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

class Main {
	public static void main(String[] args) {
	    BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
	    try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	}
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

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

int main(void){

    int n;
    cin >> n;

    vector<vector<vector<int>>> array(4, vector<vector<int>>(3, vector<int>(10, 0)));

    roop(i, n){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        array[a-1][b-1][c-1] += d;
    }

    roop(i, 4){
        roop(j, 3){
            roop(k, 10){
                cout << " " << array[i][j][k];
            }
            cout << endl;
        }
        if(i != 3) cout << "####################" << endl;
    }

    return 0;
}


Measured memory_bytes: 3132
n = int(input())
ans = 1
maxnum_devide = 0
for num in range(2, n+1):
  target = num
  num_devide = 0
  while target % 2 == 0:
    target /= 2
    num_devide += 1
  if num_devide > maxnum_devide:
    ans = num
    maxnum_devide = num_devide
print(ans)


Measured memory_bytes: 61908
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n, x, m[100];
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> m[i];
	}
	sort(m, m + n);
	int ta = 0;
	for (int i = 0; i < n; i++) {
		ta += m[i];
	}
	cout << n + ((x - ta) / m[0]) << endl;
	return 0;
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  if(N==3){
    cout << "2 5 63" << endl;
    return 0;
  }else if(N==4){
    cout << "2 5 20 63" << endl;
    return 0;
  }
  int a,b;
  a = N/2; a -= a%2;
  b = N - a;
  if(N>=15000){
    a = 10000; b = N - a;
  }
  // a = 2x, b = 3x
  dump(a,b);
  vi ans;
  int x = 2;
  int s = 0;
  int cnt = 0;
  while(true){
    if(x%3==0){
      x+=2; continue;
    }else{
      ans.pb(x);
      s += x;
      x += 2;
      cnt++;
      if(cnt==b-1) break;
    }
  }
  if(s%3==0){
    ans[b-2]+=2; x+=2; s+=2;
    if(ans[b-2]%3==0){
      ans[b-2]+=2; x+=2; s+=2;
    }
  }
  while(true){
    if((s+x)%3==0){
      ans.pb(x);
      s+=x;
      break;
    }else{
      x += 2;
      continue;
    }
  }
  if(N==19999){
    ans[b-2] -= 4;
    ans[b-1] -= 4;
  }
  dump(s);
  s = 0;
  REP(i,1,a+1){
    ans.pb(i*3);
    s += i*3;
  }
  if(s%2!=0) ans[N-1]+=3;
  dump(s);
  if(N==19999){
    ans[N-1]-=4;
  }
  rep(i,N) cout << ans[i] << (i!=N-1 ? " " : "");
  cout << "" << endl;
  return 0;
}


Measured memory_bytes: 640
import numpy as np
from functools import reduce

S = input()
S =  [int(i) for i in list(str(S))]
d = 753
for i in range(int(len(S)-2)):
    c = abs(int(reduce(lambda x,y: x+y, [str(x) for x in S[i:i+3]]))-753) 
    if d>c:
        d = c
print(str(int(d)))

Measured memory_bytes: 20900
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }




int N, T;

int defaultValue(int n) {
	if (n % 10 == 0) return n;

	return (n / 10) * 10 + 10;
}



signed main() {
	int arr[5];
	int arr2[5];
	cin >> arr[0] >> arr[1] >> arr[2] >> arr[3] >> arr[4];

	int last = LL_HALFMAX;
	for (int i = 0; i < 5; i++) {

		if (arr[i] % 10 == 0) continue;
		
		if (arr[i] % 10 < last) {
			last = arr[i] % 10;
		}
	}

	bool completed = false;
	for (int i = 0; i < 5; i++) {
		int val = 0;
		if (arr[i] % 10 == last && !completed) {
			val = arr[i];
			completed = true;
		}
		else {
			val = defaultValue(arr[i]);
		}
		arr2[i] = val;
	}
	
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		ans += arr2[i];
	}
	cout <<  ans << "\n";

	return 0;
}

Measured memory_bytes: 256
c=[]
for i in range(3):
    x=list(map(int,input().split()))
    c.append(x)
flag=False
if c[0][0]-c[0][1]==c[1][0]-c[1][1]==c[2][0]-c[2][1]:
    if c[0][1]-c[0][2]==c[1][1]-c[1][2]==c[2][1]-c[2][2]:
        if c[0][0]-c[0][2]==c[1][0]-c[1][2]==c[2][0]-c[2][2]:
            if c[0][0]-c[1][0]==c[0][1]-c[1][1]==c[0][2]-c[1][2]:
                if c[0][0]-c[2][0]==c[0][1]-c[2][1]==c[0][2]-c[2][2]:
                    if c[2][0]-c[1][0]==c[2][1]-c[1][1]==c[2][2]-c[1][2]:
                        flag=True

if flag:
    print('Yes')
else:
    print('No')


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

int main() {
    string s, r, s1 = "", s2 = "";
    cin >> s;
    r = s;
    reverse(r.begin(), r.end());
    rep(i, s.size()) {
        if(s[i] != r[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = 0; i < (s.size() - 1) / 2; i++) {
        s1 += s[i];
    }
    for(int i = (s.size() + 1) / 2; i < s.size(); i++) {
        s2 += s[i];
    }
    r = s1;
    reverse(r.begin(), r.end());
    rep(i, s1.size()) {
        if(s1[i] != r[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    r = s2;
    reverse(r.begin(), r.end());
    rep(i, s2.size()) {
        if(s2[i] != r[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3604
H,W = map(int,input().split())
m = [list(input()) for _ in range(H)]
x = [1, 0, -1, 0, 1, -1, -1, 1]
y = [0, 1, 0, -1, 1, 1, -1, -1]

for i in range(H):
    for j in range(W):
        if(m[i][j] == "#"):
            continue
        count = 0
        for d in range(8):
            nx = j + x[d]
            ny = i + y[d]
            if((nx < 0 or W <= nx) or (ny < 0 or H <= ny)):
                continue
            if(m[ny][nx] == "#"):
                count +=1
        m[i][j]=str(count)
for i in range(H):
    print(''.join(m[i]))


Measured memory_bytes: 3188
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		String s = sc.next();

		int n = Integer.parseInt(s);
		int total = 0;
		for (int i = 0; i < s.length(); i++) {
			total += s.charAt(i) - '0';
		}

		out.println(n % total == 0 ? "Yes" : "No");
		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) return true;
		else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}

	private byte readByte() {
		if (hasNextByte()) return buffer[ptr++];
		return -1;
	}

	private boolean isPrintableChar(byte c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public int nextInt() {
		if (!hasNext()) throw new NoSuchElementException();
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

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

	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

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

Measured memory_bytes: 21076
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;
const int mod = 1e9 + 7;
int n;
int a[maxn];
int p[maxn];
void init() {
    for (int i = 2; i <= 1000; i++) {
        if(p[i]) continue;
        for (int j = i * i; j <= 1000; j += i)
            p[j] = 1;
    }
}
void solve() {
    init();
    while(cin >> n) {
        if(n == 1) {
            cout << 1 << endl;
            continue;
        }
        if(n == 2) {
            cout << 2 << endl;
            continue;
        }
        if(n == 3) {
            cout << 4 << endl;
            continue;
        }
        //cout << n << endl;
        memset(a, 0, sizeof a);
        for (int i = 2; i <= n; i++) {
            int t = i;
            for (int j = 2; j <= t; j++) {
                if(p[j] || (t % j != 0)) continue;
                while(t % j == 0) {
                    a[j]++;
                    t /= j;
                }
            }
        }
        ll res = 1;
        for (int i = 2; i <= n; i++) {
            if(p[i]) continue;
            //cout << i << " " << a[i] + 1 << endl;
            res = (res * (a[i] + 1)) % mod;
        }
        cout << res << endl;
    }

}
int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#define RG register
using namespace std;
const int N=1e5+10;
int n,a[4][N],num[2],to[N];
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline void swp(I&a,I&b){a^=b; b^=a; a^=b;}
template<typename I>inline I abss(const I a){return a>0 ? a : -a;}
int main()
{
//	freopen("Rotate 3x3.in","r",stdin);
	read(n);
	for(RG int i=1;i<=n;i++) 
	{
		read(a[1][i]);
		if(a[1][i]%3==2) return printf("No\n"), 0;
	}
	for(RG int i=1;i<=n;i++)
	{
		read(a[2][i]); to[i]=(a[2][i]-1)/3+1;
		if(a[2][i]%3!=2 || (a[2][i]-1)/3!=(a[1][i]-1)/3 || abss(to[i]-i)&1) return printf("No\n"), 0;
		num[i&1]^=(a[1][i]>a[2][i]);
	}
	for(RG int i=1;i<=n;i++)
	{
		read(a[3][i]);
		if((a[3][i]-1)/3!=(a[2][i]-1)/3) return printf("No\n"), 0;
	}
	for(RG int i=1;i<=n;i++)
	 while(to[i]!=i) num[i&1^1]^=1, swp(to[i],to[to[i]]);
	printf("%s\n",num[0]|num[1] ? "No" : "Yes");
	return 0;
}

Measured memory_bytes: 1792
//Robs Code
/***********HEADER***************/
#include<bits/stdc++.h>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 10000007
#define mxval 1e9
#define grt [](auto x,auto y){return x>y;}
#define pii pair<int,int>
/*********VARIABLE****************/
using namespace std;
int i,j,n,m,k,l,q,t,a,b,sum[3],tot[3],cnt[3];
/***********MAIN******************/
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n;
    vector<int> v(n),v1(n),v2(n);
    fri(0,n-1) cin>>v[i];
    v1[0] = v[0];
    int gcd = v[i];
    for(i=1;i<n;i++){
        v1[i] = __gcd(v1[i-1],v[i]);
    }
    v2[n-1] = v[n-1];
    for(i=n-2;i>=0;i--){
        v2[i] = __gcd(v2[i+1],v[i]);
    }
    int mx = v2[1];
    for(i=1;i<n-1;i++){
        mx = max( mx , __gcd(v1[i-1],v2[i+1]) );
    }
    mx = max(mx , v1[n-2]);
    cout<<mx;
	return 0;
}
//.........


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

typedef long long ll;
ll MOD = 1000000007;

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

    vector <int> a(n+1, 0), b(n+1, 0);
    for (int i = 0; i < n; i++) cin >> a[i+1];
    
    for (int i = n; i > 0; i--) {
        int t = 0;
        for (int j = i; j <= n; j += i) {
            t += b[j];
        }
        if (a[i] != (t%2)) b[i] = 1;
    }
    vector<int> ans;
    rep(i, n)if (b[i+1])ans.push_back(i+1);
	cout << ans.size() << endl;
	rep(i, ans.size()) {
		if (i > 0)cout << " ";
		cout << ans[i];
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	unsigned long long a,b,n; cin>>a>>b>>n;
	unsigned long long x;
	if(b>n) x=n;
	else x=n/b*b-1;
	cout<<a*x/b-a*(x/b);
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <set>
#include <stack>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cstring>
#include <queue>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;

int main() {
	int N, K;
	cin >> N >> K;
	N--;
	K--;

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

	if (N%K == 0) 
	{
		cout << N / K;
	}
	else
	{
		cout << N / K + 1;
	}
}


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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n+1);
    rep(i, 1, n+1) cin >> a[i];
    vector<ll> ans(n+1);
    ll m = 0;
    for(ll i = n; i > 0; i--){
        ll j = 2*i;
        ll c = 0;
        while(j <= n){
            c += ans[j];
            j += i;
        }
        if(c%2 != a[i]){
            ans[i] = 1;
        }else{
            ans[i] = 0;
        } 
        if(ans[i] > 0) m++;
    }
    cout << m << endl;
    rep(i, 1, n+1){
        if(ans[i] > 0) cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<limits>
int main(){
    int n;
    long long  sum=0;
    int min= 1000000;
    int max= -1000000;
    std::cin>>n;
    for(int i=0;i<n;i++){
        int x;
        std::cin>>x;
        if(min>=x)min=x;
        if(max<=x)max=x;
        sum+=x;
    }   
    std::cout<<min<<" "<<max<<" "<<sum<<"\n";

}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    // if sort is required
    sort(res.begin(), res.end());
    return res;
}

void Main() {
	int N; cin >> N;
	auto d = divisor(N);
	for (auto num : d) {
		int tmp = N / num;
		if (tmp <= 9 && num <= 9) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll X,k = 0;
  cin >> X;
  rep(i,X+1){
    k += i;
    if(k >= X){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
using System;
    class Program
    {
    	static void Main(string[] args)
    	{
    		var split = Console.ReadLine().Split(' ');
    		int time = int.Parse(split[0]);
    		int costPerHour = int.Parse(split[1]);
    		int costMax = int.Parse(split[2]);
    		Console.WriteLine(Math.Min(time*costPerHour, costMax).ToString());
    	}
    }

Measured memory_bytes: 11092
//
//  header_useful.h
//  c++_acm
//
//  Created by 李弘辰 on 2019/7/23.
//  Copyright © 2019 李弘辰. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>

using namespace std;

#define ll long long
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long

#define INT_INF 0x7fffffff

#define pi acos(-1)

#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)

#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!

#define itn int
#define nit int
#define inr int
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return


/* header_useful_h */


vector<int> g[100010];
int vis[100010] = {0};

int a[100010];
int c = 0;

void dfs(int n) {
    vis[n] = 1;
    int ok = 1;
    for (auto i : g[n]) {
        if (a[i] >= a[n]) ok = 0;
        if (!vis[i]) dfs(i);
    }
    if (ok) c ++;
}

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i = 1;i <= n;i ++) {
        scanf("%d",a + i);
    }
    int u,v = 1;
    for (int i = 0;i < m;i ++) {
        scanf("%d%d",&u,&v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for (int i = 1;i <= n;i ++) {
        if (!vis[i]) dfs(i);
    }
    printf("%d\n",c);
    return 0;
}


Measured memory_bytes: 10360
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    vector<string> solve(vector<string>& S) {
        int n = S.size();
        map<string,int> cnts;
        for (auto& s : S) {
            ++cnts[s];
        }
        int mx = 0;
        for (auto& P : cnts) {
            mx = max(mx, P.second);
        }

        vector<string> res;
        for (auto& P : cnts) {
            if (P.second == mx) {
                res.push_back(P.first);
            }
        }
        sort(res.begin(), res.end());
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<string> S;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        S.push_back(s);
    }

    Solution sol;
    auto res = sol.solve(S);
    for (auto& s : res) {
        cout << s << "\n";
    }
    return 0;
}

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

// 小数点以下桁数
// fixed << setprecision(i)

int gcd(int a,int b){return (a%b==0?b:gcd(b, a%b));}
int lcm(int a,int b){return a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応

double len_xy(int x1, int x2, int y1, int y2)
{
  return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int main()
{
  int n, x, y;
  vector<pair<int, int>> xy(8);
  double ans = 0;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> x >> y;
    xy[i] = make_pair(x, y);
  }
  for (int i = 0; i < n - 1; i ++)
  {
    for (int j = i + 1; j < n; j++)
      ans += len_xy(xy[i].first, xy[j].first, xy[i].second, xy[j].second);
  }
  ans = ans * 2 / n;
  cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  ll a=100;
  ll cnt=0;
  const ld r=1.01;
  ll x;
  cin>>x;
  while(a<x){
    a*=r;
    cnt++;
  }
  cout<<cnt;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define bg begin
namespace IO{
	
cs int RLEN=1<<20|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
	(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob)?EOF:*ib++;
}
inline int read(){
	char ch=gc();
	int res=0;bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
	return f?res:-res;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	return top;
}

}
using IO::read;
using IO::readstring;
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int N=1000005,M=16;
int pw[M];
char str[N];
int n,m,tot,id[N],ans[N],lc[N],rc[N],pc[N],rev[N];
void build(int &u,int dep,int ps){
	u=++tot;
	if(dep==n){
		id[u]=ps;
		return;
	}
	build(lc[u],dep+1,ps);
	build(rc[u],dep+1,ps+pw[dep]);
	build(pc[u],dep+1,ps+2*pw[dep]);
}
void pushnow(int u){
	rev[u]^=1,swap(rc[u],pc[u]);
}
void pushdown(int u){
	if(!rev[u])return;
	if(lc[u])pushnow(lc[u]);
	if(rc[u])pushnow(rc[u]);
	if(pc[u])pushnow(pc[u]);
	rev[u]=0;
}
void move(int u,int dep){
	pushdown(u);
	if(dep==n)return;
	swap(rc[u],pc[u]),swap(rc[u],lc[u]);
	move(lc[u],dep+1);
}
void dfs(int u,int dep,int ps){
	pushdown(u);
	if(dep==n){ans[id[u]]=ps;return;}
	dfs(lc[u],dep+1,ps);
	dfs(rc[u],dep+1,ps+pw[dep]);
	dfs(pc[u],dep+1,ps+2*pw[dep]);
}
int main(){
	#ifdef Stargazer
	freopen("lx.in","r",stdin);
	#endif
	n=read();pw[0]=1;int rt=0;
	m=readstring(str);
	for(int i=1;i<M;i++)pw[i]=pw[i-1]*3;
	build(rt,0,0);
	for(int i=1;i<=m;i++)
	if(str[i]=='S')pushnow(rt);
	else move(rt,0);
	dfs(rt,0,0);
	for(int i=0;i<pw[n];i++)cout<<ans[i]<<" ";puts("");
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    rep2 (x, 1, n+1) {
        int res = 0;
        rep2(i, 1, sqrt(n)+1) {
            rep2 (j, i, sqrt(n)+1) {
                rep2 (k, j, sqrt(n)+1) {
                    int p = i * i + j * j + k * k + i * k + j * k + i * j;
                    if (p > x) break;
                    if (p == x) {
                        if (i == j && j == k) res++;
                        else if (i != j && i != k && j != k) res += 6;
                        else res += 3;
                    }
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int n, k;
    int a[100000];
    cin >> n >> k;
    rep(i, n){
        cin >> a[i];
    } 

    int ret = k;
    int ans;
    for (ans = 0; ret < n; ans++)
    {
        ret += k-1;
    }

    cout << ans + 1;
    

    return 0;
}

Measured memory_bytes: 640
data class Restaurant(val id: Int, val city: String, val score: Int)

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val restaurants = Array(n, {
    val id = it + 1
    val tokens = readLine()!!.split(" ")
    Restaurant(id, tokens[0], tokens[1].toInt())
  })
  restaurants.sortByDescending { it.score }
  restaurants.sortBy { it.city }
  restaurants.forEach { println(it.id) }
}

Measured memory_bytes: 35988
#include<iostream>
#include<queue>
using namespace std;
struct data
{
	int x;
	int y;
};
struct mapData
{
	int black;
	int white;
};
int main()
{
	int w, h;
	int dx[4] = {1,0,-1,0};
	int dy[4] = {0,1,0,-1};
	while (cin >> w >> h && w != 0 || h != 0)
	{
		char map[50][50];
		for (int i = 0; i < h; i++)
		{
			cin >> map[i];
		}

		mapData whiteBlack[50][50];
		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				whiteBlack[i][j].black = 0;
				whiteBlack[i][j].white = 0;
			}
		}

		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				if (map[i][j] == '.')continue;
				int color = (map[i][j] == 'B' ? 1 : 2);
				queue<data> q;
				data first;
				first.x = j;
				first.y = i;
				q.push(first);
				while (q.size() > 0)
				{
					data d = q.front(); q.pop();
					if (map[d.y][d.x] == '.')
					{
						if (color == 1)
						{
							whiteBlack[d.y][d.x].black = 1;
						}
						else
						{
							whiteBlack[d.y][d.x].white = 1;
						}
					}
					for (int k = 0; k < 4; k++)
					{
						int nx = dx[k] + d.x;
						int ny = dy[k] + d.y;
						if (nx >= w || ny >= h || nx < 0 || ny < 0)continue;
						if (map[ny][nx] == 'W' || map[ny][nx] == 'B')continue;
						if (color == 1 && whiteBlack[ny][nx].black == 1)continue;
						if (color == 2 && whiteBlack[ny][nx].white == 1)continue;
						data add;
						add.x = nx;
						add.y = ny;
						q.push(add);
					}
				}
			}
		}
		int white = 0;
		int black = 0;
		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				if (whiteBlack[i][j].black == 1 && whiteBlack[i][j].white == 0)
				{
					black++;
				}
				else if (whiteBlack[i][j].white == 1 && whiteBlack[i][j].black == 0)
				{
					white++;
				}
			}
		}

		cout << black << " " << white << endl;
	}
	return 0;
}

Measured memory_bytes: 54840
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    if(n>m) swap(n,m);
    ll ans;
    if(n==1){
        if(m==1){
            ans = 1;
        }else{
            ans =  max(0LL, m-2);
        }
    }else{
        ans = (n-2) * (m-2); 
    }
    cout << ans << endl;

    return 0;
}

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

string s[110],t[110];
int main(){
 int n,m;
 cin >> n;
 for (int i=0;i<n;i++) cin >> s[i];
 cin >> m;
 for (int i=0;i<m;i++) cin >> t[i];
 
 int ans=0;
 for (int i=0;i<n;i++){
   int score = 0;
   for (int j=0;j<n;j++) if(s[j]==s[i]) score++;//j枚目の青いカードに書かれている文字列とi枚目の青いカードに書かれている文字列
   for (int j=0;j<m;j++) if(t[j]==s[i]) score--;//j枚目の赤いカードに書かれている文字列とi枚目の青いカードに書かれている文字列
   ans = max(ans, score);
 }
  cout << ans << endl;
}
//やばい意味わからん


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main implements Runnable {

    private void solve() throws IOException {
        String s = reader.readLine();
        s = s.replaceAll(","," ");
        writer.println(s);
    }

    public static void main(String[] args) {
        new Main().run();
    }

    BufferedReader reader;
    //    BufferedReader reader2;
    StringTokenizer tokenizer;
    PrintWriter writer;
    //    BufferedWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
//            reader = new BufferedReader(new FileReader("highcard.in"));
            //            reader2 = new BufferedReader(new FileReader("1.in"));
            tokenizer = null;
            writer = new PrintWriter(System.out);
//            writer = new     PrintWriter("highcard.out");
//                                                    writer = new BufferedWriter(System.out);
            //                        writer = new BufferedWriter(new OutputStreamWriter(System.out));
            solve();
            reader.close();
            //            reader2.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

    short nextShort() throws IOException {
        return Short.parseShort(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }

        return tokenizer.nextToken();
    }

}

Measured memory_bytes: 8404
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

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

ll factorial(ll n) {//階乗
	ll ret = 1;
	rep(i, 1, n + 1)
		ret = (ret *i) % MODU;

	return ret;
}

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b, ll m) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * 1LL * mod_pow(b, m - 2, m)) % m;
}
ll ncr(ll n, ll r) {
	return divmod(factorial(n), (factorial(r) * (factorial(n - r))) % MODU, MODU);
}


signed main() {
	int a, b;
	cin >> a >> b;
	set<int> ans;
	ans.insert(1);
	ans.insert(2);
	ans.insert(3);
	ans.erase(a);
	ans.erase(b);
	cout << *ans.begin() << endl;
	return 0;
}


Measured memory_bytes: 256
let sx, sy, tx, ty = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let dx, dy, f = tx - sx, ty - sy, String.make
let _ = for e = 0 to 1 do Printf.printf "%s%s%s%s%s%s%s%s" (f e 'L') (f (dy + e) 'U') (f (dx + e) 'R') (f e 'D') (f e 'R') (f (dy + e) 'D') (f (dx + e) 'L') (f e 'U') done

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

int n;

void dfs(string s){
  if(s.size() == n){
    cout << s << endl;
    return;
  }
  set<char> alpha;
  for(auto ss : s){
    alpha.insert(ss);
  }

  for(int i = 0; i <= alpha.size(); ++i){
    string ns = s + (char)('a' + i);
    dfs(ns);
  }
}

int main(){
  cin >> n;
  dfs("");
}


Measured memory_bytes: 1536
#include <iostream>

int N,M;
int a[50];
int b[50];

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

  std::cin >> N >> M;
  for (int i =0; i < M; i++) std::cin >> a[i] >> b[i];
  int num[N] = {0};
  for (int i = 0; i < M; i++){
    num[a[i]-1]++;
    num[b[i]-1]++;
  }
  for (int i = 0; i < N; i++) std::cout << num[i] <<'\n';
}


Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
M = []

result = 0

if len(T) > K:
    for i in range(K):
        if T[i] == 'r':
            result += P;
        elif T[i] == 's':
            result += R
        else:
            result += S
        M.append('win')
    for i in range(K, len(T)):
        if T[i - K] != T[i] or (T[i - K] == T[i] and M[i - K] == 'lose'):
            if T[i] == 'r':
                result += P
            elif T[i] == 's':
                result += R
            else:
                result += S
            M.append('win')
        else:
            M.append('lose')
            continue
else:
    for i in range(len(T)):
        if T[i] == 'r':
            result += P
        elif T[i] == 's':
            result += R
        else:
            result += S

print(result)

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

using namespace std;

const int nmax = 105;
const int inf = 0x3f3f3f3f;

vector<tuple<int, int, int> > edges;
int g[nmax][nmax];
int n, m;

int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      g[i][j] = inf;
  for (int i = 1; i <= n; i++) g[i][i] = 0;
  for (int i = 1, a, b, c; i <= m; i++) {
    cin >> a >> b >> c;
    edges.emplace_back(a, b, c);
    g[a][b] = g[b][a] = c;
  }

  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        g[i][j] = min(g[i][k] + g[k][j], g[i][j]);
      }
    }
  }

  int ans = 0;
  for (const auto& edge : edges) {
    int a, b, c;
    tie(a, b, c) = edge;
    bool ok = false;
    for (int i = 1; i <= n && !ok; i++) {
      for (int j = 1; j <= n && !ok; j++) {
        if (g[i][a] + g[b][j] == g[i][j] - c || g[i][b] + g[a][j] == g[i][j] - c)
          ok = true;
      }
    }
    if (!ok) ans++;
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	ll K, N, syu = 0;
	vector<pair<ll,ll>>list(200005, make_pair(9999999,0));
	//vector<pair<int, int>>list(2000);


	cin >> N >> K;

	//list[0].first = 999999999;

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

		if (list[num].first >= 9999999) {
			syu++;
			list[num].first = 1;
			list[num].second = num;
		}
		else {
			list[num].second = num;
			list[num].first++;
		}
	}

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

	ll ans = 0;

	if (syu > K) {
		ll sa = syu - K;
		for (int i = 0; i < sa; i++) {
			ans += list[i].first;
		}
		cout << ans << endl;
	}
	else {
		cout << 0 << endl;
	}


	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int x, y, z;
	cin >> x >> y >> z;
	cout << z << ' ' << x << ' ' << y << endl;
}

Measured memory_bytes: 256
n, k = list(map(int, input().split()))
l = list(range(1, n + 1))

for i in l:
    if i < k:
        for r in range(1, 18):
            l[i - 1] = l[i - 1] * 2
            if l[i - 1] >= k:
                l[i -1] = (1 / n) * (0.5 ** r)
                break
    else:
        l[i -1] = (1 / n)
print(sum(l))


Measured memory_bytes: 6900
/*
  mail: mleautomaton@foxmail.com
  author: MLEAutoMaton
  This Code is made by MLEAutoMaton
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=200010,Mod=1e9+7;
int fac[N],fai[N],inv[N],h,w,a,b;
void init(){
	fac[0]=fai[0]=inv[0]=inv[1]=1;
	for(int i=1;i<=200000;i++)fac[i]=1ll*fac[i-1]*i%Mod;
	for(int i=2;i<=200000;i++)inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
	for(int i=1;i<=200000;i++)fai[i]=1ll*fai[i-1]*inv[i]%Mod;
}
int C(int n,int m){if(n<m || m<0 || n<0)return 0;return 1ll*fac[n]*fai[m]%Mod*fai[n-m]%Mod;}
int num(int a,int b){return C(a+b,a);}
int main(){
	init();
	h=gi();w=gi();a=gi();b=gi();int ans=0;
	for(int i=1;i<=h-a;i++){
		//(1,1)->(i,b)   (i,b+1)->(h,w)
		ans=(ans+1ll*num(i-1,b-1)*num(h-i,w-b-1)%Mod)%Mod;
//		printf("%d %d\n",num(i-1,b-1),num(h-i,w-b-1));
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2560
// A - B +/- A

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int a, b;

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

    if (b % a == 0) {
        cout << a + b << endl;
    } else {
        cout << b - a << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9;
typedef pair<int,int> pii;
int n, x, y, dep[200005], par[20][200005];
int da[200005], db[200005];

vector<int> ra[200005], rb[200005];
vector<pii> red;

queue<int> q;

void calc (int cur, int prv) {
	dep[cur] = dep[prv] + 1;
	par[0][cur] = prv;
	for(auto &nxt : rb[cur]) {
		if(nxt == prv) continue;
		calc(nxt, cur);
	}
}

int getdist (int A, int B) {
	if(dep[A] < dep[B]) swap(A, B);
	int ret = 0;
	for(int i=20;i--;) {
		if(dep[A] - dep[B] >= (1<<i)) {
			A = par[i][A]; ret += (1<<i);
		}
	}
	if(A == B) return ret;
	for(int i=20;i--;) {
		if(par[i][A] != par[i][B]) {
			A = par[i][A]; B = par[i][B];
			ret += (1<<i) * 2;
		}
	}
	return ret + 2;
}

int main() {
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<n;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		red.push_back({A, B});
		ra[A].push_back(B);
		ra[B].push_back(A);
	}
	for(int i=1;i<n;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		rb[A].push_back(B);
		rb[B].push_back(A);
	}
	calc(1, 0);
	for(int k=1;k<20;k++) {
		for(int i=1;i<=n;i++) {
			par[k][i] = par[k-1][par[k-1][i]];
		}
	}
	for(int i=1;i<=n;i++) {da[i] = inf; db[i] = inf;}
	db[y] = 2; q.push(y);
	while(!q.empty()) {
		int cur = q.front(); q.pop();
		for(auto &nxt : rb[cur]) {
			if(db[nxt] == inf) {
				db[nxt] = db[cur] + 2;
				q.push(nxt);
			}
		}
	}
	da[x] = 1; q.push(x);
	while(!q.empty()) {
		int cur = q.front(); q.pop();
		for(auto &nxt : ra[cur]) {
			if(da[nxt] == inf && db[nxt] > da[cur] + 3) {
				da[nxt] = da[cur] + 2;
				q.push(nxt);
			}
		}
	}
	for(auto &T : red) {
		int A = T.first, B = T.second;
		if(getdist(A, B) >= 3 && (da[A] != inf || da[B] != inf)) {
			puts("-1"); return 0;
		}
	}
	int ans = 0;
	for(int i=1;i<=n;i++) {
		if(da[i] != inf) ans = max(ans, db[i]);
	}
 	printf("%d\n",ans-2);
}





Measured memory_bytes: 50672