akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define YESNO(i) puts((i)?"YES":"NO");
#define YesNo(i) puts((i)?"Yes":"No");
#define yesno(i) puts((i)?"yes":"no");
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c;cin>>a>>b>>c;
  print((a+b+c<22)?"win":"bust");
  return 0;
}

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

#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define pb push_back
#define X first
#define Y second

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 1000000007L;

#ifdef umang99m
    #include "/home/umang/.templates/header.h"
#else
    #define dbg(args...)
    #define timer()
#endif

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

    ll n;
    cin>>n;
    vi a(n);
    vi f(n+1,0);
    rep(i,n){
        cin>>a[i];
        f[a[i]]++;
    }
    ll ans =0;
    rep(i,n+1){
        ans += f[i]*(f[i]-1);
    }
    rep(i,n){
        cout<<(ans - (f[a[i]]-1)*2)/2<<"\n";
    }
    timer();
    return 0;
}


Measured memory_bytes: 5760
def resolve():
    n, s = map(int, input().split())
    a = list(map(int,input().split()))
    dp = [[0]*(s+10) for _ in range(n+10)]
    dp[0][0] = 1
    mod = 998244353
    for i in range(1,n+1):
        nexta = a[i-1]
        for j in range(0, s+1):
            dp[i][j] += (2 * dp[i - 1][j])% mod
            if j + nexta > s:
                continue
            else:
                dp[i][j+nexta] += (dp[i-1][j])%mod
    print((dp[n][s])%mod)
resolve()

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int dp[2][1024];

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  REP(q, N) {
    string X, Y;
    cin >> X >> Y;
    int LX = X.size(), LY = Y.size();
    REP(i, 2) REP(j, LY+1) dp[i][j] = 0;
    REP(i, LX) REP(j, LY) {
      if (X[i] == Y[j]) {
	dp[(i+1)%2][j+1] = dp[i%2][j] + 1;
      } else {
	dp[(i+1)%2][j+1] = max(dp[(i+1)%2][j], dp[i%2][j+1]);
      }
    }
    cout << dp[LX%2][LY] << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>

using namespace std;

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

	int n,k;
	cin >> n >> k;

	map<int,int> a;
	int tmp;
	for(int i=0; i<n; i++){
		cin >> tmp;
		if(a.find(tmp) == a.end()) a[tmp] = 1;
		else						a[tmp]++;
	}

	vector<int> num;
	for(auto i=a.begin(); i!=a.end(); i++) num.push_back(i->second);
	sort(num.begin(), num.end());
	int ans=0;
	for(int i=0; i<(int)num.size()-k; i++)	ans += num[i];

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

Measured memory_bytes: 10744
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }


class Parser {
public:
	using Iter = string::const_iterator;
	Iter it;
	Iter it2;
	Parser(Iter it, Iter it2) :it(it), it2(it2) {}
	void cmp(char expected) { if (*it != expected)cerr << *it << " is not " << expected << endl; assert(*it == expected); }
	/*
	EBNF
	??????="(",[??????],")[",??°,"](",[??????],")"
	*/
	void a() {
		if (*it == '('&&*it2 == '(') {
			cmp('('); it++; it2++; cout << '(';
			a();
			cmp(')'); it++; it2++; cout << ')';
			cmp('['); it++; it2++; cout << '[';
			cout << (integer(it) + integer(it2));
			cmp(']'); it++; it2++; cout << ']';
			cmp('('); it++; it2++; cout << '(';
			a();
			cmp(')'); it++; it2++; cout << ')';
		}
		else {
			if (*it == '(') {
				it++;
				a();
				it++;
				it++;
				integer(it);
				it++;
				it++;
				a();
				it++;
			}
			if (*it2 == '(') {
				it2++;
				a();
				it2++;
				it2++;
				integer(it2);
				it2++;
				it2++;
				a();
				it2++;
			}
		}
	}
	int integer(Iter &it) {
		int ret = 0;
		while (isdigit(*it)) {
			ret *= 10;
			ret += *it - '0';
			it++;
		}
		return ret;
	}
};

signed main() {
	string s1, s2; getline(cin, s1); getline(cin, s2);
	s1 += "$"; s2 += "$";
	Parser P(s1.begin(), s2.begin());
	P.a();
	cout << endl;
	return 0;
}

Measured memory_bytes: 3204
#include <stdio.h> 
 
int main() {
  int x,i,n;
 
  scanf("%d",&n);
   
  for(i=1; i<=n; i++) {
    x = i;
     
    if(x %3 == 0) {
      printf(" %d",i);
    } else if(x % 10 == 3) {
      printf(" %d",i);
    } else { 
      while(x != 0) {
    x /=10;
    if(x % 10 == 3) {
      printf(" %d",i);
      break;
    }
      }
    }
     
  }
  printf("\n");
  return 0;
}


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

int main(){
    int W,H,N;
    cin >> W >> H >> N;
    vector<int> MAX_X(H,0), MAX_Y(W,0);
    rep(i,N){
        int x,y;
        cin >> x >> y ;
        MAX_X[y] = max(MAX_X[y], x);
        MAX_Y[x] = max(MAX_Y[x], y);
    }

    for(int y=H-2;y>=0;y--) MAX_X[y] = max(MAX_X[y], MAX_X[y+1]);
    for(int x=W-2;x>=0;x--) MAX_Y[x] = max(MAX_Y[x], MAX_Y[x+1]);

    for(int y=0;y<H-1;y++) MAX_X[y] = MAX_X[y+1];
    for(int x=0;x<W-1;x++) MAX_Y[x] = MAX_Y[x+1];

    MAX_X[H-1] = 0;
    MAX_Y[W-1] = 0;

    int ans = 1e9;
    for(int y=0;y<H;y++) ans = min(ans, y+MAX_X[y]);
    for(int x=0;x<W;x++) ans = min(ans, x+MAX_Y[x]);

    cout << ans << endl;
}



Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<stdio.h>
#include<stdlib.h>

void int_display(int *A,int n)
{
  int i;
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1) printf(" ");
  }
  printf("\n");
}

int bubble_sort(int *A,int n)
{
  int i,j,Aj,swap;
  swap=0;
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
        Aj=A[j];
        A[j]=A[j-1];
        A[j-1]=Aj;
        swap++;
      }
    }
  }
  return swap;
}

int main()
{
  int *A;
  int i,n,swap;
  scanf("%d",&n);
  A=malloc(n*sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  swap=bubble_sort(A,n);
  int_display(A,n);
  printf("%d\n",swap);
  return 0;
}

Measured memory_bytes: 1808
#include <iostream>
#include <string>

using namespace std;
int dp[101][51];
int data[101][51];

void solve()
{
	string str;
	string sdata[51];
	int temp;
	int line = 0;
	int pos = 0;
	while(cin >> str)
	{
		pos = 0;
		int size = str.size();
		for(int i = 0; i < size; ++i)
		{
			if(str[i] == ',')
			{
				pos++;
				continue;
			}
			sdata[pos] += str[i];
		}
		pos++;
		
		for(int i = 0; i < pos; ++i)
		{
			int temp = 1;
			size = sdata[i].size();
			for(int j = size - 1; j >= 0; --j)
			{
				data[line][i] += (sdata[i][j] - '0') * temp;
				temp *= 10;
			}
		}
		line++;
		for(int i = 0;i < pos; ++i)
		{
			sdata[i].clear();
		}
	}
	dp[0][0] = data[0][0];
	for(int i = 1; i < line / 2 + 1; ++i)
	{
		for(int j = 0; j <= i; ++j)
		{
			if(j == 0)
			{
				dp[i][j] = dp[i - 1][j] + data[i][j];
			}
			else if(j == i)
			{
				dp[i][j] = dp[i - 1][j - 1] + data[i][j];
			}
			else
			{
				dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j]) + data[i][j];
			}
		}
	}
	for(int i = line / 2 + 1; i < line; ++i)
	{
		for(int j = 0; j < line - i; ++j)
		{
			dp[i][j] = max(dp[i - 1][j], dp[i - 1][j + 1]) + data[i][j];
		}
	}
	cout << dp[line - 1][0] << endl;
}

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define MP make_pair
#define pb push_back
const int INF = 1e9;
const int MOD = INF+7;
using P = pair<int,int>;


int main(){
    int H,W,h,w;
    cin >> H >> W >> h >> w;
    cout << (H-h)*(W-w) << endl; 
}

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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


bool judge(int a, int b, int c) {
    if ((a > b && b > c) || (a < b && b < c)) return true;
    return false;
}

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

    ll A, B;
    cin >> A >> B;

    if ((A + B) % 2 != 0) cout << "IMPOSSIBLE" << endl;
    else cout << ((A + B) / 2) << endl;

    return 0;
}


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

using namespace std;

int main()
{
    long long int n;

    cin >> n;

    if (n % 2)
    {
        cout << 0 << "\n";
        return 0;
    }

    long long int ans = 0;
    long long int m = 1;

    while (m <= n)
    {
        m = m * 5;
        ans = ans + ((n / m) / 2);
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
    #include <bits/stdc++.h>
    #define ll  long long
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    #define vi vector<int>
    #define br cout <<"\n";
    #define all(x)  (x).begin(),(x).end()
    #define tr(c,i) for(auto i : c)
    #define pii pair< int,int >
    #define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
    #define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
    #define er(x) cout << x << " "
    #define err(x,y) cout << x << " "<<y
    using namespace std;
    clock_t time_p = clock();
    void dem()
    {
        time_p=clock()-time_p;
        cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
    }
    using namespace std ;
    const int MAX =  1000 * 1000 + 10;
    const int dx[] = { 1, -1 , 0 , 0  };
    const int dy [] = { 0 ,0 , 1 , -1  };
    const int MOD = 1000 * 1000 * 1000 + 9 ;
    const int N = 301 ;
    const int INF = INT_MAX ;
    const int M = 200005;


    int main (){
   int a , b ;
   cin >> a >> b ;
   if ( a >= 10 || b >= 10  )
        cout << "-1" ;
   else
    cout << a * b ;

    return 0 ;
    }
/*
1
10
5 6 5 2 1 7 9 7 2 5
*/



Measured memory_bytes: 384
import java.util.*;

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

        int N = sc.nextInt();

        if (N % 2 == 0) {
            System.out.println(N / 2 - 1);
        } else {
            System.out.println(N / 2);
        }
    }
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int main(){
	int p,q,r;
	cin >> p >> q >> r;
	int a,b,c;
	a= p+q;
	b=q+r;
	c=r+p;

	cout << min(min(a,b),c);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
using namespace std;
typedef long long ll;

int main(){
    ll n;cin>>n;
    if(n%2)cout<<2*n;
    else cout<<n;
}

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

using namespace std;

typedef long long int64;

int main()
{
  int64 N, A[100000];
  int64 sum = 0;

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

  int64 B[100000];
  for(int i = 0; i < N; i++) {
    B[i] = A[(i + 1) % N] - A[i];
  }

  int64 num = N * (N + 1) / 2;
  if(sum % num != 0) {
    cout << "NO" << endl;
    return (0);
  }
  sum /= num;

  for(int i = 0; i < N; i++) {
    int64 beet = B[i] - sum;
    if(beet > 0 || beet % N != 0) {
      cout << "NO" << endl;
      return (0);
    }
  }

  cout << "YES" << endl;

}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
      	boolean res = false;
      	while(N>0){
          	int x = N%10;
          	if(x==7){
            	res = true;
              	break;
            }
          	N/=10;
        }
      	if(res) System.out.print("Yes");
      	else System.out.print("No");
    }
}

Measured memory_bytes: 35712
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  Set<String> s = new HashSet<String>();
  int counter = 0;
  for(int i = 0;i < N;i++){
    int a = sc.nextInt();
    if(a < 400)s.add("a");
    else if(a < 800)s.add("b");
    else if(a < 1200)s.add("c");
    else if(a < 1600)s.add("d");
    else if(a < 2000)s.add("e");
    else if(a < 2400)s.add("f");
    else if(a < 2800)s.add("g");
    else if(a < 3200)s.add("h");
    else if(a >= 3200)counter++;
  }
  if(s.size() == 0){
    System.out.println("1");
  }
  else{
    System.out.print(s.size() > 8 ? "8" : s.size());
  }
  System.out.print(" ");
  System.out.println(s.size() + counter);
}}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int N;
    cin >> N;
    string s;
    cin >> s;
    string t;
    cin >> t;
    int ans = N;
    REP(i, N){
        if(s.substr(i) == t.substr(0, N-i)) break;
        ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
n,l,t=gets.split.map &:to_i
q=0
a=[]
n.times{
	x,y=gets.split.map &:to_i
	x+=t*(y*-2+3)
	q+=x/l # x/l is floor
	a<<x%l
}
a.sort!
puts a.rotate(q%n)

Measured memory_bytes: 4456
n=int(input())
l=[int(i) for i in input().split()]
l.extend(l)
from fractions import gcd
lst1=[l[0]]
lst2=[l[-1]]
for i in range(1,n):
    lst1.append(gcd(lst1[-1],l[i]))
for i in range(n-1,-1,-1):
    lst2.append(gcd(lst2[-1],l[i]))
lst2=lst2[::-1]
lst=[]
for i in range(n):
    if i==0:
        lst.append(lst2[1])
    if i==n-1:
        lst.append(lst1[-2])
    else:
        lst.append(gcd(lst1[i-1],lst2[i+1]))
print(max(lst))

Measured memory_bytes: 14056
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	int N, M, Q;
	cin >> N >> M;
	cout << (N*(N-1) + M*(M-1))/2 << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    s=LIST()
    s.sort()
    a=s.pop(-1)
    if sum(s)>a:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include <iostream>
#include <string>

int main() {
  std::string first;
  std::string second;
  std::string third;

  std::cin >> first;
  std::cin >> second;
  std::cin >> third;
  
  std::cout << first[0] << second[1] << third[2] << std::endl;
  
}

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

using namespace std;

string s, t;
int DP[3001][3001];
int Choice[3001][3001];

int LCS(int i, int j) {
	if (DP[i][j] != -1) { return DP[i][j]; }
	if (i == s.length() || j == t.length()) { return DP[i][j] = 0; }

	int ans = 0;
	if (s[i] == t[j]) { ans = 1 + LCS(i + 1, j + 1); }
	else {
		int c1 = LCS(i + 1, j);
		int c2 = LCS(i, j + 1);
		if (c1 > c2) { Choice[i][j] = 0; ans = c1; }
		else { Choice[i][j] = 1; ans = c2; }
	}

	return DP[i][j] = ans;
}

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

	for (int i = 0; i < 3001; i++)
		for (int j = 0; j < 3001; j++)
			DP[i][j] = Choice[i][j] = -1;

	LCS(0, 0);
	int i = 0, j = 0;
	string ans = "";
	while (i < s.length() && j < t.length()) {
		if (s[i] == t[j]) { ans.push_back(s[i]); i++; j++; continue; }
		if (Choice[i][j] == 0) { i++; }
		else { j++; }
	}

	cout << ans << endl;
}

Measured memory_bytes: 70912
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_2_A&lang=ja

INF = 10**9
n,e = map(int, input().split())
gl = [ [INF]*(n) for _ in range(n)]

for _ in range(e):
    s,t,d = map(int, input().split())
    gl[s][t] = d

dp = [ [INF]*(n) for _ in range(2**n) ]
dp[1][0] = 0
for i in range(2**n):
    for j in range(n):
        if dp[i][j] == INF: continue
        for k in range(n):
            if (i>>k)%2 == 1: continue
            dp[i|(1<<k)][k] = min(dp[i][j]+gl[j][k], dp[i|(1<<k)][k])

ans = INF
for i in range(1,n): 
    if gl[i][0] != INF:
        ans = min(ans, dp[2**n-1][i] + gl[i][0])

if ans == INF: ans = -1
print(ans)


Measured memory_bytes: 15448
import java.util.*;

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

        int[] cmp = new int[10];
        String ans = "No";
        cmp[A]++;
        cmp[B]++;
        cmp[C]++;
        for (int i = 0; i < 10; i++) {
            if(cmp[i] == 2) {
                ans = "Yes";
            }
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 21844
# ABC102C - Linear Approximation (ARC100C)
from statistics import median


def main():
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))
    A = tuple(j - i for i, j in enumerate(A, start=1))
    b = median(A)
    ans = sum(abs(a - b) for a in A)
    print(int(ans))


if __name__ == "__main__":
    main()

Measured memory_bytes: 27472
using System;

namespace ConsoleApp1
{
    class Class1
    {
        static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            long ans = long.Parse(input[0]);
            var isOver = false;

            for (int i = 1; i < N; i++)
            {
                var A = long.Parse(input[i]);
                if (A == 0)
                {
                    ans = 0;
                    break;
                }

                if (!isOver)
                {
                    try
                    {
                        checked
                        {
                            var result = ans * A;
                            if (result > 1000000000000000000)
                            {
                                isOver = true;
                            }
                            else
                            {
                                ans = result;
                            }
                        }
                    }
                    catch
                    {
                        isOver = true;
                        ans = -1;
                    }
                }
            }

            if (ans == 0)
            {
                Console.WriteLine(0);
            }
            else if (isOver)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(ans);
            }
        }
    }
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define llong long long
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

const llong MOD = 1e9+7;

llong kaijou(llong k) {
  llong sum = 1;
  for (llong i=1; i<=k; i++) {
    sum = (sum * i) % MOD;
  }
  return sum;
}

void solve()
{
  llong ans=0;

  llong n, m;
  cin >> n >> m;

  if (abs(n-m) > 1) {
    cout << 0 << endl;
    return;
  }

  ans = (kaijou(n) * kaijou(m)) % MOD;

  if (n==m) ans = (ans*2) % MOD;

  cout << ans << endl;
}

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


Measured memory_bytes: 256
from collections import Counter

H,W = map(int,input().split())
dp = [[0]*10 for _ in range(10)]

for i in range(10):
  dp[i] = list(map(int,input().split()))
  
for k in range(10):
  for i in range(10):
    for j in range(10):
      dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
      
el = []
for i in range(H):
  el += list(map(int,input().split()))
  
S=Counter(el)
r = 0
for i in range(10):
  r += S[i]*dp[i][1]
  
print(r)

Measured memory_bytes: 41436
N = int(input())
def gener():
    i = 2
    while True:
        if i%2==0 or i%3==0 or i%5==0:
            yield i
        i+=1
gen = gener()
ans = []
for j in range(N-2):
    ans.append(gen.__next__())
S = sum(ans)
while True:
    g = gen.__next__()
    p = S + g
    if p%2==0 or p%3==0 or p%5==0:
        ans.append(g)
        break
while True:
    g = gen.__next__()
    p2 = p + g
    if p2%30==0:
        ans.append(g)
        break
print(*ans)

Measured memory_bytes: 4544
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mods 1000000009

LL power(LL a,LL b)
{
    LL sum=1;
    for(int i=1;i<=a;i++)
    sum=sum*b;
    return sum;
}

long long b_mod(long long b,long long p,long long mod)
{
    if(p==0)
    return 1;
    if(p%2==0)
    {
        long long ret=b_mod(b,p/2,mod);
        return ((ret%mod)*(ret%mod))%mod;
    }
    else
    return ((b%mod)*(b_mod(b,p-1,mod)%mod))%mod;
}

long long ar[10009];
int factorila()
{
    long long s=1;
    ar[0]=1;
    for(int i=1;i<=10000;i++)
    {
        ar[i]=(ar[i-1]*i)%100000007;
    }
    return 0;
}
char st[10000009];
int main()
{
   // factorila();
    //freopen("amin.txt","w",stdout)
    int n,cn=1,a,b,m,i,j,l;

    scanf("%d",&n);
    scanf("%d",&m);
    if(n==m)
    printf("Draw\n");
    else if(n==1 and m!=1)
    printf("Alice\n");
    else if(m==1 and n!=1)
    printf("Bob\n");
    else if(n<m)
    printf("Bob\n");
    else
    printf("Alice\n");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b, c, x; cin >> a >> b >> c >> x;
    ll cnt = 0;
    for(ll i=0; i<=a; i++){
        for(ll j=0; j<=b; j++){
            for(ll k=0; k<=c; k++){
                if(500*i + 100*j + 50*k == x) cnt++;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() { 
  int A[4][3][10];
  rep(i,4){
    rep(j,3){
      rep(k,10) A[i][j][k]=0;
    }
  }
  
  int n;
  cin>>n;
  
  int b,f,r,v;
  rep(i,n){
    cin>>b>>f>>r>>v;
    b--,f--,r--;
    A[b][f][r]+=v;
  }
  
  rep(i,4){
    rep(j,3){
      rep(k,10) cout<<" "<<A[i][j][k];
      cout<<endl;
    }
    if(i!=3){
      rep(k,20) cout<<'#';
      cout<<endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3076
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define DEBUG(x) cout << (#x) << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main()
{
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    ll ub = (N - 1) * (N - 2) / 2;
    if (K > ub)
    {
        cout << "-1" << endl;
        return 0;
    }

    vector<pll> ans;
    for (int i = 1; i <= N - 1; ++i)
    {
        ans.emplace_back(i, N);
    }

    ll rest = ub - K;
    vector<pll> stock;
    for (int i = 1; i <= N - 1; ++i)
        for (int j = i + 1; j <= N - 1; ++j)
            stock.emplace_back(i, j);

    REP(i, rest)
    {
        ans.push_back(stock[i]);
    }

    cout << ans.size() << endl;
    for (auto &p : ans)
        cout << p.first << " " << p.second << endl;
    return 0;
}


Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N,T,A,a[1010];
	double p;
	int x,h;
	while(cin>>N){
		memset(a,0,sizeof(a));
		cin>>T>>A;
		p=(T-A)/0.006;
		h=999999999;
		x=0;
		for(int i=1;i<=N;i++){
			cin>>a[i];
		}
		for(int i=1;i<=N;i++){
			if(h>fabs(p-a[i]))
			{
				h=fabs(p-a[i]);
				x = i;
			}
		}
	cout<<x<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;
#define INF 1000000000000
#define NOD 1000000007
#define PI 3.141592653589793238462643

int main() {
    str n;
    cin >> n;
    bool c=false;
    REP(i, 3) if(n[i] == '7') c = true;
    Yes(c);
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt(),D=sc.nextInt();
		int ans=1;

		while(true) {
			if((2*D+1)<N) {
				ans++;
				N-=2*D+1;
			}else {
				break;
			}
		}
		System.out.println(ans);
	}
}

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

    stack<char> kakko;

int main() {
  string str;
  char x;
  while(getline(cin,str)) {
    if(str == ".") return 0;
    bool r = true;

    while(!kakko.empty()) {
      kakko.pop();
    }

    for(unsigned int i=0;i<str.size();i++) {
      x = *str.substr(i,1).c_str();
      if(x == '(' || x == '[') {
        kakko.push(x);
      }
      else if(x == ')') {
        if(!kakko.empty()) {
          if(kakko.top() == '(') {
            kakko.pop();
          }
          else {
            r = false;
          }
        }
        else {
          r = false;
        }
      }
      else if(x == ']') {
        if(!kakko.empty()) {
          if(kakko.top() == '[') {
            kakko.pop();
          }
          else {
            r = false;
          }
        }
        else {
          r = false;
        }
      }
    }
    if(r && kakko.empty()) cout << "yes" << endl;
    else cout << "no" << endl;
  }
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B == C + D)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
  return 0;
}

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

int main() {
  int k;
  string s;
  cin >> k >> s;
  
  if (s.size() > k) {
    s = s.substr(0, k) + "...";
  }
  
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define sp " "
#define cs "Case "
#define fi first
#define sn second

/* STL */
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxi(v) distance(v.begin(),max_element(v.begin(),v.end()))
#define mxa(a) *max_element(a, a.size())
#define r(a)   reverse(a.begin(),a.end())
/* loops */
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n) i=1;i<=(n);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(something)  cerr<<#something<<" - "<<something<<"\n";

int main()
{

   Ezio
   ll t,m,n,x,a,b;
   string s;

   cin>>n>>x;
   a= __gcd(n,x);
   cout<<3*(n-a)<<endl;
   return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
int n;
int a[100001];
int c;
int main(){
    cin >> n;
    for(int i = 0; i < n; i++)  cin >> a[i];
    sort(a, a+n);

    for(int i = 1; i < n; i++){
        if(a[i] == a[i-1])   ++c;
    }
    if(c%2 != 0)    ++c;
    cout << n-c << endl;
}

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

int main(){
  
  int n;
  cin >> n;
  
  vector< tuple<string, int, int> > v(n);

  rep(i, n){
    string s;
    int a;
    cin >> s >> a;
    v[i] = make_tuple(s, a, i+1);
  }

  sort(v.begin(), v.end(), [](const auto &x, const auto &y){
    return get<0>(x) == get<0>(y) ? get<1>(x) > get<1>(y) : get<0>(x) < get<0>(y);
  });

  rep(i, n){
    cout << get<2>(v[i]) << endl;
  }

}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a, b, k;
  scanf("%d %d", &a, &b);
  k = (a + b) % 2;
  if (k == 0)
  {
    printf("%d", (a + b) / 2);
  }
  else
  {
    printf("IMPOSSIBLE");
  }

  return 0;
}

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

int a, b, c;

int main() {
    cin >> a >> b >> c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);

    cout << s.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}

void solve()
{
	// 2 3 
	// 2 2 
	// 5 
	// 2 3
	// 4 - 2
	// 2 - 3
	// 1 - 5
	// C(7, 4) 
	// 5 * 6 * 7 / 2 / 3
	int n;
	cin >> n;
	vector<ll> cnt(n + 1, 0);
	for(int i = 2; i <= n; ++i){
		int x = i;
		for(int j = 2; j <= sqrt(n); ++j){
			while(x % j == 0){
				x /= j;
				cnt[j]++;
			}
		}
		if(x != 1) ++cnt[x];
	}
	ll res = 1;
	for(int i = 2; i <= n; ++i){
		res *= cnt[i] + 1;
		res %= mod;
	}
	cout << res;
}	 

 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 3600
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long int  ll;
typedef long double  ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
vv64 dp;
int h,w;
vv32 mat;
ll solve(int x,int y){
	if(x>=h || y>=w) return 0;
	if(dp[x][y]!=-1) return dp[x][y];
	ll c=0;
	if(x+1<h) c+=solve(x+1,y);
	if(y+1<w) c+=solve(x,y+1);
	c%=MOD;
	return dp[x][y]=c;
}
int main(){
	fastio;
	cin>>h>>w;
	dp.assign(h,v64(w,-1));
	mat.assign(h,v32(w,0));
	char ch;
	forn(i,h){
		forn(j,w){
			cin>>ch;
			if(ch=='.') mat[i][j]=1;
			else dp[i][j]=0;
		}
	}
	dp[h-1][w-1]=1;
	cout<<solve(0,0)<<ln;
	return 0;
}

Measured memory_bytes: 12160
#include <stdio.h>
 
typedef struct {
  int data[100100];
  int size;
} Stack;
 
void init(Stack* st) {
  st->size = 0;
}
int top(Stack* st) {
  return st->data[st->size - 1];
}
void pop(Stack* st) {
  st->size--;
}
void push(Stack* st, int v) {
  st->data[st->size] = v;
  st->size++;
}
 
int is_operator(char* s) {
  return *s == '+' || *s == '-' || *s == '*';
}
int eval_operator(char op, int a, int b) {
  if (op == '+') return (a + b);
  if (op == '-') return (a - b);
  if (op == '*') return (a * b);
  return printf("sine\n");
}
 
int main(void)
{
  Stack calc_;
  Stack* calc = &calc_;
  char token[16];
   
  init(calc);
  while (scanf("%s", token) == 1) {
    if (is_operator(token)) {
      int lhs, rhs;
      rhs = top(calc);
      pop(calc);
      lhs = top(calc);
      pop(calc);
      push(calc, eval_operator(token[0], lhs, rhs));
    } else {
      push(calc, atoi(token));
    }
  }
  printf("%d\n", top(calc));
  return 0;
}


Measured memory_bytes: 1992
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<int,int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define error(x) cerr << #x << " = " << x << endl
#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int INF = 1e9 + 7;

string a, b;
int main(void) {
    ios_base::sync_with_stdio(0), cin.tie(nullptr);
    cin >> a >> b;
    while (sz(a) < sz(b)) a = "0" + a;
    while (sz(a) > sz(b)) b = "0" + b;
    for (int i = 0; i < sz(a); ++i) {
        if (a[i] > b[i]) return cout << "GREATER\n", 0;
        if (a[i] < b[i]) return cout << "LESS\n", 0;
    }
    cout << "EQUAL\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define nax 100000
int Max( int a, int b){
	return a > b? a:b;
}
int main(){
	int size;
	int dp[nax][3];
	int point[nax][3];
	scanf("%i",&size);
	for (int i = 0;i<size;i++){
		for (int j=0;j<3;j++){
			scanf("%i",&point[i][j]);
		}
	}
	memset(dp,'\0',sizeof(dp));
	dp[0][0]  = point[0][0];
	dp[0][1] = point[0][1];
	dp[0][2] = point[0][2];
	for(int i=1;i<size;i++){
		dp[i][0] = Max(dp[i-1][2],dp[i-1][1])+point[i][0];
		dp[i][1] = Max(dp[i-1][0],dp[i-1][2])+point[i][1];
		dp[i][2] = Max(dp[i-1][1],dp[i-1][0])+point[i][2];
	}
	int answ = Max(dp[size-1][0],Max(dp[size-1][1],dp[size-1][2]));
	printf("%i",answ);
}


Measured memory_bytes: 2560
#include <stdio.h>
int main(void){
    int a,b,c;
    
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    
    if(a+b+c>=22)
    printf("bust");
    if(a+b+c<=21)
    printf("win");
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int a,b;
    vector<int> p(n);
    for (int i = 0; i < n;i++){
        cin >> p[i];
    }
    double e = 0.0;
    double d = 0.0;
    for (int i = 0; i < k; i++)
    {
        e += (1.0 + p[i]) /2.0;
        d = e;
    }
    for (int i = k; i < n; i++)
    {
        d = d+double((p[i] - p[i - k])) / 2.0;
        if(d>=e){
            e = d;
        }
    }
    cout << fixed << setprecision(15) << e << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <functional>
using namespace std;

typedef long long ll;

int n;
vector<pair<pair<bool, int>, int>> p[100002];
int d1[100002], dN[100002];

int from1(int index, int dis);
int fromN(int index, int dis);

int main() {
	cin >> n;
	int a, b;
	int ai, bi;
	for (int i = 0; i < n - 1; i++) {
		cin >> a >> b;
		ai = p[a].size();
		bi = p[b].size();
		p[a].push_back({ { true, b }, bi});
		p[b].push_back({{ true, a }, ai});
	}
	from1(1, 0);
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < p[i].size(); j++) p[i].at(j).first.first = true;
	}
	fromN(n, 0);
	int f = 0, s = 0;
	for (int i = 1; i <= n; i++) {
		if (d1[i] <= dN[i]) f++;
		else s++;
	}
	if (f > s) cout << "Fennec" << endl;
	else cout << "Snuke" << endl;
	return 0;
}

int from1(int index, int dis) { 
	d1[index] = dis;
	if (index != 1 && p[index].size() <= 1) return 0;
	for (int i = 0; i < p[index].size(); i++) {
		if (p[index].at(i).first.first) {
			p[index].at(i).first.first = false;
			p[p[index].at(i).first.second].at(p[index].at(i).second).first.first = false;
			from1(p[index].at(i).first.second, dis + 1);
		}
	}
	return 0;
}

int fromN(int index, int dis) {
	dN[index] = dis;
	if (index != n && p[index].size() <= 1) return 0;
	for (int i = 0; i < p[index].size(); i++) {
		if (p[index].at(i).first.first) {
			p[index].at(i).first.first = false;
			p[p[index].at(i).first.second].at(p[index].at(i).second).first.first = false;
			fromN(p[index].at(i).first.second, dis + 1);
		}
	}
	return 0;
}

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

int main() {
    int n, m, x, y;
    std::cin >> n >> m >> x >> y;
    std::vector<int> a(n + 1), b(m + 1);
    for (int i = 0; i < n; i++) std::cin >> a[i];
    for (int i = 0; i < m; i++) std::cin >> b[i];
    a[n] = x; b[m] = y;
    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());
    if (a[n] < b[0]) std::cout << "No War" << std::endl;
    else std::cout << "War" << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    while(cin >> n, n) {
        string a, s;
        int cnt = 0;
        vector<vector<int>> G;
        map<string, int> m;
        vector<int> isgroup(10000);
        for (int i = 0; i < n; ++i) {
            cin >> s;
            string M;
            vector<string> sub;
            string buf;
            for (auto &&j : s) {
                if(isalpha(j)) buf += j;
                else if(j == ':'){
                    M = buf;
                    buf.clear();
                }else if(j == ',' || j == '.'){
                    sub.emplace_back(buf);
                    buf.clear();
                }
            }
            if(!m[M]) {
                m[M] = ++cnt;
                G.resize(cnt);
            }
            isgroup[m[M]-1] = 1;
            for (auto &&t : sub) {
                if(!m[t]) {
                    m[t] = ++cnt;
                    G.resize(cnt);
                }
                G[m[M]-1].emplace_back(m[t]-1);
            }
            if(!i) a = M;
        }
        vector<int> visited(cnt);
        stack<int> S;
        S.emplace(m[a]-1);
        int ans = 0;
        visited[S.top()] = 1;
        while(!S.empty()){
            int x = S.top(); S.pop();
            if(!isgroup[x]) ans++;
            for (auto &&j : G[x]) {
                if(!visited[j]) {
                    visited[j] = 1;
                    S.emplace(j);
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3208
//
///
//
//
///
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ri(a,b,c) for(ll a=(b);a<(c);++a)

#define fcout cout << fixed << setprecision(10)
int main(){
    //cin.tie(0);
    //ios::sync_with_stdio(false);

    ll b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
    cin>>n;
    ll a[n];
    ri(i,0,n){
        cin>>p;
        a[i]=p-i;
    }
    sort(a,a+n);
    q=0;
    p=a[(n-1)/2];
        ri(i,0,n){
            q+=abs(a[i]-p);
        }
        ++m;
    cout<<q<<"\n";

    return 0;
}


Measured memory_bytes: 1792
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	p := nextInts(n)
	var ans int
	var prev int
	for i := 0; i < n; i++ {
		if i == 0 {
			prev = p[i]
			ans++
			continue
		}
		if prev < p[i] {
			continue
		} else {
			prev = p[i]
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3712
N,K = map(int,input().split())
ans = 0

if K == 0:
    ans = N**2
else:
    for b in range(K,N+1):
        d = N//b
        r = N%b
        ans += d*max(0,b-K) + max(0,r-K+1)

print(ans)

Measured memory_bytes: 3060