akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  ll n,k;
  cin>>n>>k;
  vector<int> A(n);
  rep(i,n){
    cin>>A[i];
    A[i]--;
  }
  int now = 0;
  vector<bool> checked(n, false);
  checked[now] = true;
  while(k > 0){
    now = A[now];
    k--;
    if(checked[now]) break;
    checked[now] = true;
  }
  int count = 0;
  fill(all(checked), false);
  checked[now] = true;
  while(k > 0){
    now = A[now];
    k--;
    count++;
    if(checked[now]) break;
    checked[now] = true;
  }

  if(k == 0){
    cout << now + 1 << endl;
    return 0;
  }

  k %= count;
  while(k > 0){
    now = A[now];
    k--;
  }

  cout << now + 1 << endl;
  return 0;
}

Measured memory_bytes: 3948
x,y=map(int,input().split())
priseX=0
priseY=0
if x==1:
  priseX=300000
elif x==2:
  priseX=200000
elif x==3:
  priseX=100000
if y==1:
  priseY=300000
elif y==2:
  priseY=200000
elif y==3:
  priseY=100000
if x==1 and y==1:
  print(1000000)
else:
  print(priseX+priseY)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N,ans=0;
    cin >> N;

    for(int i = 1;i <= N;i++){
        if(i % 2 != 0)
            ans++;
    }

    double a = ans / (double)N;

    cout << a << endl;


}

Measured memory_bytes: 3732
#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 n, m;
    cin >> n >> m;

    priority_queue<pair<int, int>> que;
    rep(i,n) { 
        int a;
        cin >> a;
        que.push(make_pair(a, 1));
    }
    rep(i,m) {
        int b, c;
        cin >> b >> c;
        que.push(make_pair(c, b));
    }

    ll cnt = 0;
    ll tot = 0;
    while (cnt < n) {
        auto p = que.top(); que.pop();
        int c = p.first;
        int b = p.second;
        rep(i,b) {
            cnt++;
            tot += c;
            if (cnt == n) break;
        }
    }

    cout << tot << endl;

    return 0;
}


Measured memory_bytes: 2420
import scala.io.{StdIn => in}

object Main extends App {
  val mod = 1000000007
  val n = in.readInt

  val Array(a, c, g, t) = Array(0, 1, 2, 3)
  val dp = Array.ofDim[Long](n+1, 4, 4, 4)
  dp(0)(t)(t)(t) = 1

  for {
    // len(全体) : i + j + k + x
    // len(全体) : _ + A + G + C  <- ガード式1行目
    len <- 0 until n
    i <- 0 until 4
    j <- 0 until 4
    k <- 0 until 4
    if dp(len)(i)(j)(k) != 0
    x <- 0 until 4
    if !((j == a && k == g && x == c) ||
         (j == g && k == a && x == c) ||
         (j == a && k == c && x == g) ||
         (i == a && k == g && x == c) ||
         (i == a && j == g && x == c) )
  } {
    dp(len+1)(j)(k)(x) += dp(len)(i)(j)(k)
    dp(len+1)(j)(k)(x) %= mod
  }

  val ans = dp(n).flatten.flatten.sum % mod
  println(ans)
}

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

const long INF = LONG_MAX / 2;

int main(){
    long N, K;
    cin >> N >> K;
    vector<long> v(N);
    for (int i = 0; i < N; i++ ){
        cin >> v[i];
    } 
    sort(v.begin(), v.end());
    long ans = INF;
    for (int i = 0; i + K-1 < N; i++)
    {
        ans = min(ans, v[i+K-1] - v[i]);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> A(5);
  for(int i=0;i<5;i++) {
    cin>>A.at(i);
  }
  int k;
  cin>>k;
  sort(A.begin(),A.end());
  if(A.at(4)-A.at(0)>k){
    cout<<":("<<endl;
  }
  else{
    cout<<"Yay!"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int  h,hh, w,ww,max,i,x,xx,j,a1,a2;
  while(1){
    scanf("%d%d",&h,&w);
    if(h==0&&w==0)break;
    x=h*h+w*w;
    max=22500;
    for(i=1;i<151;i++){
      for(j=150;i<j;j--){
	xx=i*i+j*j;
	if((x==xx&&x<max&&h<i)||(x<xx&&xx<max)){
	  max=xx;
	  a1=i;
	  a2=j;
	}	 
	if(max==x)break;
      }
    }
    printf("%d %d\n",a1,a2);
  }
  return 0;
}
 

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

typedef struct{
	int parent; //parent
	int left; //chlid of left
	int right; //sibling of right
}Node;

int main(){
	int n, k, id, ch, r, dep, p, i, j;
	Node *T;

	scanf("%d", &n);

	T = malloc(sizeof(Node)*n);

	//initialize
	for(i = 0; i < n; i++){
		T[i].parent = -1;
		T[i].left = -1;
		T[i].right = -1;
	}

	for(i = 0; i < n; i++){
		scanf("%d %d", &id, &k);

		for(j = 0; j < k; j++){
			scanf("%d", &ch);
			T[ch].parent = id;

			if(j == 0) T[id].left = ch; //insert left child
			else if(j > 0) T[r].right = ch; //insert sibling

			r = ch;
		}
	}

	for(j = 0; j < n; j++){
		dep = 0;
		p = T[j].parent;

		//parent of root = -1
		while(p != -1){
			p = T[p].parent;
			dep++;
		}
		if(dep == 0){
			printf("node %d: parent = -1, depth = 0, root, [", j);
		}
		else if(T[j].left == -1){
			printf("node %d: parent = %d, depth = %d, leaf, [", j, T[j].parent, dep);
		}
		else{
			printf("node %d: parent = %d, depth = %d, internal node, [", j, T[j].parent, dep);
		}

		p = T[j].left;
		if(p != -1) printf("%d", p);

		while(p != -1){
			p = T[p].right;
			if(p != -1) printf(", %d", p);
		}
		printf("]\n");
	}

	return 0;
}

Measured memory_bytes: 1788
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5, 0);
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ii = 0;
  const int dot = count(S.begin(), S.end(), '.');
  const int sharp = N - dot;
  int ans = dot;
  int dot_l = 0;
  int sharp_l = 0;
  int tmp_ans = 0;
  for (auto c : S) {
    tmp_ans = 0;
    if (c == '.') {
      dot_l += 1;
    } else {
      sharp_l += 1;
    }
    tmp_ans = sharp_l + dot - dot_l;
    ans = min(ans, tmp_ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
    public static Queue<T> ToQueue<T>(this IEnumerable<T> seq) => new Queue<T>(seq);
    public static Stack<T> ToStack<T>(this IEnumerable<T> seq) => new Stack<T>(seq);
}
static class MyMath
{
    static private long gcdInner(long a, long b) => (a % b == 0) ? b : gcdInner(b, a % b);
    static public long GCD(long a, long b) => (a > b) ? gcdInner(a, b) : gcdInner(b, a);
    static public long LCM(long a, long b) => (a > b) ? (a / GCD(a, b) * b) : (b / GCD(a, b) * a);
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();


    static long xxxx = 1000000000 + 7;
    static void Main()
    {
        var L = Console.ReadLine().Reverse().ToArray();
                
        //k桁目までの選択法バリエーション
        long[] kkk = new long[L.Length];
        kkk[0] = L[0] == '0' ? 1 : 3;
        for(int i = 1; i < L.Length; i++)
        {
            if (L[i] == '0')
            {
                kkk[i] = kkk[i - 1];
                kkk[i] %= xxxx;
            }
            else
            {
                kkk[i] = kkk[i - 1];
                kkk[i] %= xxxx;
                kkk[i] += kkk[i - 1];
                kkk[i] %= xxxx;
                kkk[i] += ddddd(i);
                kkk[i] %= xxxx;
            }
        }

        Console.WriteLine(kkk[L.Length - 1]);
    }

    static Dictionary<long, long> table = new Dictionary<long, long>();

    //k桁の2進数で、a + b = a xor b となるものの個数を求める
    static long ddddd(long k)
    {
        if (k == 0)
        {
            return 1;
        }
        else if (table.ContainsKey(k))
        {
            return table[k];
        }
        else
        {
            var ans = ddddd(k - 1) * 3;
            ans %= xxxx;
            
            table[k] = ans;

            return ans;
        }
    }
}

Measured memory_bytes: 25056
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, al, bl;
  string k, l;
  int ans[1001][1001];
  cin >> N;

  rep(i, N){
    cin >> k;
    cin >> l;

    al = k.length();
    bl = l.length();


    rep(j, al+1){
      rep(s, bl+1){
        ans[j][s] = 0;
      }
    }

    rep(j, al){
      rep(s, bl){
        if(k[j] == l[s]){
          ans[j+1][s+1] = max(ans[j+1][s], max(ans[j][s+1], ans[j][s] + 1));
        } else{
          ans[j+1][s+1] = max(ans[j+1][s], ans[j][s+1]);
        }
      }
    }

    cout << ans[al][bl] << "\n";



  }
}


Measured memory_bytes: 7136
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string N;
  cin>>N;
  long long judge=0;
  for(int i=0;i<N.size();i++){
    judge+=(char)N[i]-'0';
  }
  if(judge%9==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  return 0;
}

Measured memory_bytes: 3356
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappush, heappushpop

N,M = map(int,input().split())
tasks = [[] for _ in range(M+1)] # 価値、締切
for _ in range(N):
    a,b = map(int,input().split())
    if a <= M:
        tasks[M-a].append(b)

q = []
for day in range(M+1):
    for v in tasks[day]:
        if len(q) < day+1:
            heappush(q,v)
        else:
            heappushpop(q,v)

answer = sum(q)
print(answer)

Measured memory_bytes: 18628
#include <iostream>
#include <string>
#include <algorithm>
#define T_MAX 31
#define N_MAX 21
using namespace std;


struct Pdata{
  string name;
  int point;
  int m; 
};

bool operator < ( const Pdata &p, const Pdata &q ){
  if( p.point == q.point ){
    return p.name < q.name;
  }else{
    return p.point < q.point;
  }
}

int main () {
  while ( 1 ) {
    int n;
    cin >> n;
    if( !n ) { return 0; }
    int table[ T_MAX ] = { 0 };
    int ds[ N_MAX ][ T_MAX ] = { 0 };
    Pdata p[ N_MAX ];
    
    for( int i = 0; i < n; i++ ) {
      cin >> p[ i ].name >> p[ i ].m;
      for( int j = 0; j < p[ i ].m; j++ ) {
        cin >> ds[ i ][ j ];
        table[ ds[ i ][ j ] ]++;
      }
    }
    for( int i = 0; i < n; i++ ) {
      p[ i ].point = 0;
      for( int j = 0; j < p[ i ].m; j++ ) {
        p[ i ].point += ( n - table[ ds[ i ][ j ] ] + 1 );
      }
    }
    sort( p, p + n );
    cout <<  p[ 0 ].point << " " << p[ 0 ].name << endl;
  }
  
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    unsigned long long a,b,c;
    cin >> a >> b >> c;
    if(max(a,b) >= c){
        cout << "No" << endl;
    }
    else if(a + b + 2*sqrtl(a*b) < c){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n, k, t = 0, ans = 0, r = 1e5;
    cin >> n >> k;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        v[i] = k+i;
        t += v[i]; 
    }
    for(int i = 0; i < n; i++){
        int u = 0;
        for(int j = 0; j < n; j++){
            if(i != j){
                u += v[j];
            }
        }
        if(abs(t-u) <= r){
            ans = u;
            r = abs(t-u);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
int a,b,c,r,l;
cin>>a>>b;
l=a+b;
if(a<b){
   c = a;
   a = b;
   b = c;
}
    r = a % b;
 while(r!=0){
   a = b;
   b = r;
   r = a % b;
 }
 cout<<l-(b-1)<<endl;
}


Measured memory_bytes: 3120
import math
n, m = map(int, input().split())
if m%2 == 0:
    divisor = [1, 2, m//2, m]
else:
    divisor = [1, m]
for i in range(3, int(math.sqrt(m))+1):
    if m%i == 0:
        divisor.append(i)
        divisor.append(m//i)
divisor = sorted(divisor, reverse=True)
a = m//n
for i in divisor:
    if i > a:
        continue
    if (m-(m//i*i))%i == 0:
        break
print(i)


Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;
char a[100] , b[100];
int main(){
	while(~scanf("%s%s" , a + 1 , b + 1)){
		int len = strlen(a + 1);
		int le = strlen(b + 1);
		for(int i = 1;i <= max(len , le);i++){
			if(i <= len) printf("%c" , a[i]);
			if(i <= le) printf("%c" , b[i]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

int main() {
   string S;
   cin >> S;
   int N = S.size();
   int ans[N + 1];
   ans[0] = 0;
   ans[1] = 1;
   if (S[0] == S[1]) ans[2] = 1;
   else ans[2] = 2;

   for (int i = 2; i < N; i++) {
      if (S[i] == S[i - 1]) {
         ans[i + 1] = max(ans[i - 1] + 1, ans[i - 2] + 2);
      } else {
         ans[i + 1] = ans[i] + 1;
      }
   }
   cout << ans[N] << endl;
   return 0;
}


Measured memory_bytes: 1412
# used in AOJ No.68, yukicoder No.199
# complexity: O(n^(1/2))
eps = 1e-10


def add(a, b):
    return 0 if abs(a + b) < eps * (abs(a) + abs(b)) else a + b


class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __add__(self, p):
        return Point(add(self.x, p.x), add(self.y, p.y))

    def __sub__(self, p):
        return Point(add(self.x, -p.x), add(self.y, -p.y))

    def __mul__(self, d):
        return Point(self.x * d, self.y * d)

    def dot(self, p):
        return add(self.x * p.x, self.y * p.y)

    def det(self, p):
        return add(self.x * p.y, -self.y * p.x)

    def __str__(self):
        return "({}, {})".format(self.x, self.y)


def convex_hull(ps):
    ps = [Point(x, y) for x, y in sorted([(p.x, p.y) for p in ps])]
    lower_hull = get_bounds(ps)
    ps = ps[::-1]
    upper_hull = get_bounds(ps)
    del upper_hull[-1]
    del lower_hull[-1]
    lower_hull.extend(upper_hull)
    return lower_hull


def get_bounds(ps):
    qs = [ps[0], ps[1]]
    for p in ps[2:]:
        while len(qs) > 1 and (qs[-1] - qs[-2]).det(p - qs[-1]) < 0:
            del qs[-1]
        qs.append(p)
    return qs


def aoj():
    N = int(input())
    ps = []
    for _ in range(N):
        x, y = map(int, input().split())
        ps.append(Point(x, y))
    convex = convex_hull(ps)
    print(len(convex))
    min_idx = -1
    min_x, min_y = 10001, 10001
    for i, p in enumerate(convex):
        if p.y < min_y or (p.y == min_y and p.x < min_x):
            min_idx = i
            min_x, min_y = p.x, p.y
    for p in convex[min_idx:]:
        print(p.x, p.y)
    for p in convex[:min_idx]:
        print(p.x, p.y)


if __name__ == '__main__':
    aoj()



Measured memory_bytes: 54008
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	if (n&1) {
	   printf("%d\n",(n-1)*(n-2)/2-(n-1)/2+n-1);
	   for (int i=1;i<=n-1;i++) {
	   	for (int j=i+1;j<=n-1;j++)
            if (j!=n-i)  printf("%d %d\n",i,j);	 
	   }	
	   for (int i=1;i<=n-1;i++) printf("%d %d\n",i,n);
	}
	else {
	   printf("%d\n",n*(n-1)/2-n/2);
	   for (int i=1;i<=n;i++) {
	   	for (int j=i+1;j<=n;j++)
	   	 if (j!=n+1-i) printf("%d %d\n",i,j);
	   }	
	}
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
const double EPS = 1e-6 ; 
int fastPow(int a, int b){
    if ( b == 0 ) return 1 ;
    if ( b == 1 ) return a ;
    int y = fastPow(a, b / 2) ; 
    if ( b % 2 == 0 ){
        return ((y % MOD)  * (y % MOD)) % MOD ;
    }
    else return ((((y % MOD)  * (y % MOD)) % MOD) * (a % MOD)) % MOD  ;
}
int inverse(int x){ // The inverse when the mod is prime is always x^(mod - 2) ;
    return fastPow(x, MOD - 2) ;
}
int C(int n, int k){
    int nominator = 1 ;
    for(int i = 0; i < k; i++){
        nominator = (nominator * (n - i)) % MOD ; 
    }
    int denom = 1 ;
    for(int i = 1; i <= k; i++){
        denom = (denom * i) % MOD ; 
    }
    int ans = ( nominator * inverse(denom) ) % MOD ;
    return ans ; 
}
int fix(int x){
    return ( x % MOD + MOD ) % MOD ;
}
signed main(){
    fastio
    int n , a , b ; 
    cin >> n >> a >> b ; 
    int total = fastPow(2, n) - 1 ; // the minus one here for the empty set. Total number of subsets are equal to 2^n including the empty set. 
    int ans = fix(total - C(n , a) - C(n , b)) ;
    cout << ans << endl;
    return 0; 
}

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

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

  if (Y == 7 || Y == 5 || Y == 3){
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;

  }
  
}

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

int main() {
 	long long n, ans = 0;
  	cin >> n;
  	for(long long i = 1; i <= n; i++) {
     	if(i % 3 != 0 && i % 5 != 0) {
         	ans += i; 
        }
    }
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
typedef pair<lint, lint> P;

signed main(){
  lint N; cin >> N;
  vector<vector<lint> > G(N);
  vector<P> pa;
  for( lint i = 1; i < N; i++ ){
    lint a, b; cin >> a >> b; --a ;--b;
    G[a].push_back(b); G[b].push_back(a);
    pa.push_back(P(a, b));
  }

  queue<lint> que;
  vector<lint> used(N, -1);
  vector<lint> color(N, 0);
  map<P, lint> MAP;
  que.push(0); used[0] = 1;
  lint MAX_COLOR = 0;
  while(que.size()){
    lint v = que.front(); que.pop();
    lint num = 1;
    for( lint i = 0; i < G[v].size(); i++ ){
      lint next = G[v][i];
      if(used[next] != -1) continue;
      if(color[v] == num) num++;
      used[next] = 1;
      color[next] = num;
      MAP[P(next, v)] = num;
      MAP[P(v, next)] = num;
      num++;
      que.push(next);
    }
    MAX_COLOR = max(lint(G[v].size()), MAX_COLOR);
  }
  cout << MAX_COLOR << '\n';
  for(auto p : pa) cout << MAP[p] << '\n';
}

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

int N;


int main(){
    cin >> N;
    int H[N];
    for(int i=0;i<N;i++){
      cin >> H[i];
    }
    bool frg=1;
    for(int i=N-1;i>0;i--){
      if(H[i]<H[i-1])H[i-1]-=1;
    }
    for(int i=0;i<N-1;i++){
      if(H[i]>H[i+1])frg=0;
    }

    if(frg==0){
      cout << "No";
    }else{
      cout << "Yes";
    }



}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>

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

	std::vector<int> A(N);
	for(int &a : A) {
		std::cin >> a;
	}

	std::sort(A.begin(), A.end(), [](int a, int b) {
		return a < b;
	});

	int result;
	while(true) {
		const int n = A[0];
		for(auto itr = A.begin() + 1; itr != A.end();) {
			*itr %= n;
			if(*itr == 0) {
				itr = A.erase(itr);
			} else {
				itr++;
			}
		}

		if(A.size() == 1) {
			result = A[0];
			break;
		}

		std::sort(A.begin(), A.end(), [](int a, int b) {
			return a < b;
		});
	}

	std::cout << result << std::endl;

	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 1e5 + 10;
vector<int> e[N];

int used[N];

bool dfs(int i, int col) {
    if (used[i] == col) return true;
    if (used[i] != 0) return false;
    bool ok = true;
    used[i] = col;
    for (int u : e[i])
        ok &= dfs(u, 3 - col);
    return ok;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    while (m--) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        e[u].eb(v);
        e[v].eb(u);
    }
    ll iso = 0, comp = 0, bip = 0;
    forn(i, 0, n) if (e[i].empty()) ++iso;
    forn(i, 0, n) if (!e[i].empty() && !used[i]) {
        bool ok = dfs(i, 1);
        ++comp;
        if (ok) ++bip;
    }
    ll ans = n * n - (n - iso) * (n - iso);
    ans += comp * comp;
    ans += bip * bip;
    cout << ans << '\n';
}


Measured memory_bytes: 9984
s = int(input())
a = {s}
a_i = s
def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1
ans = 1
for _ in range(10 ** 6 + 1):
    a_i = f(a_i)
    ans += 1
    if a_i in a:
        print(ans)
        break
    else:
        a.add(a_i)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long mod = 1e9+7;
int main(void){
    long long N,A,B;
    cin >> N >> A >> B;
    long long X[N];
    rep(i,N)cin>>X[i];
    
    long long ans = 0;
    for(int i=0;i+1<N;i++){
        long long  d = (X[i+1] - X[i]) * A;
        if(d < B){
            ans+=d;
        }
        else{
            ans+= B;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3916
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

ll a[200001] = {};

int main() {
	ll N, K; cin >> N >> K;
	rep(i, 0, N) {
		ll A; cin >> A;
		a[A]++;
	}
	sort(a, a + N + 1);
	reverse(a, a + N + 1);

	ll cnt = 0;
	rep(i, K, N) {
		cnt += a[i];
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main (void){
	
	int n,m,l,i,t,a,b,k;
	long long arrayA[100][100]={},arrayB[100][100]={},arrayAB[100][100]={};
	
	scanf("%d %d %d",&n,&m,&l);
	
	for(i=0;i<n;i++){
		for(t=0;t<m;t++){
			scanf("%d",&a);
			arrayA[i][t] = a;
		}
	}
	
	for(i=0;i<m;i++){
		for(t=0;t<l;t++){
			scanf("%d",&b);
			arrayB[i][t] = b;
		}
	}
	
	for(i=0;i<n;i++){
		for(t=0;t<l;t++){
			for(k=0;k<m;k++){
				arrayAB[i][t] += arrayA[i][k]*arrayB[k][t];
			}
		printf("%lld",arrayAB[i][t]);
		if(t != l-1){
			printf(" ");
		}else{
			printf("\n");
		}
		}
	}

return 0;
}
	
	

Measured memory_bytes: 848
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] AB = Console.ReadLine().Split(' ');
            long A = int.Parse(AB[0]);long B = int.Parse(AB[1]);
            long c;
            if (A > B) { c = A;A = B;B = c; }
            long i = 1;
            while(true)
            {
                if(0 == (A * i) % B)
                {
                    Console.WriteLine(A * i);
                    return;
                }
                i++;
            }
        }
    }
}


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

int main(){
    int N;
    int *V;
    int *C;
    cin >> N;
    V = new int[N];
    C = new int[N];
    for(int i = 0; i < N; i++){
        cin >> V[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }
    int sum = 0;
    int temp;
    for(int i = 0; i < N; i++){
        temp = V[i] - C[i];
        if(temp > 0){
            sum += temp;
        }
    }
  	cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define rd(x) cin >> x;
#define rda(a,n) for(int i=1;i<=n;i++) cin >> a[i];
#define wr(x) cout << x << ' ';
#define wrl(x) cout << x << '\n';
#define wra(a,n) for(int i=1;i<=n;i++) cout << a[i] << ' '; cout << '\n';
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005
#define int long long

char ans;
vector <int> q;
int n,t=1,k=1,x=10;

int32_t main(){
    ios_base :: sync_with_stdio(0);
    while(k<10){
        cout << "? " << x << endl;
        cin >> ans;
        if(ans=='Y') k++,x*=10;
        else break;
    }
    if(k==10){
        for(int i=1;i<=1e9;i*=10){
            cout << "? " << 2*i << endl;
            cin >> ans;
            if(ans=='Y'){
                cout << "! " << i << endl;
                return 0;
            }
        }
    }
    for(int i=1;i<=k-1;i++){
        int l=0,r=9;
        if(i==1) l=1;
        else t*=10;
        while(l!=r){
            int mid=(l+r+1)/2;
            cout << "? " << 10*n+mid << endl;
            cin >> ans;
            if(ans=='N') r=mid-1;
            else l=mid;
        }
        n*=10; n+=l;
    }
    if(n){
        for(int i=0;i<=9;i++){
            cout << "? " << 100*n+10*i+1 << endl;
            cin >> ans;
            if(ans=='Y'){
                n*=10; n+=i;
                cout << "! " << n << endl;
                return 0;
            }
        }
    }
    else{
        for(int i=1;i<=9;i++){
            cout << "? " << 100*n+10*i+1 << endl;
            cin >> ans;
            if(ans=='Y'){
                n*=10; n+=i;
                cout << "! " << n << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 596
n,l = gets.split.map &:to_i
if l <= 0 && n + l > 0
    puts (0.5 * n * ( n + 1 ) + n * (l - 1)).to_i
elsif l < 0
    puts (0.5 * n * ( n + 1 ) + n * (l - 1) - (n + l - 1)).to_i
else
    puts (0.5 * n * ( n + 1 ) + n * (l - 1)  - l).to_i
end

Measured memory_bytes: 1788
#include<iostream>
#include<cmath>
#include<algorithm>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)

using namespace std;

int N, A[200005];

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

    cin >> N;
    REP(i, N) {
        cin >> A[i];
        A[i] -= i + 1;
    }
    sort(A, A + N);

    int b = A[N / 2];

    int ans = 0;
    REP(i, N) { ans += abs(A[i] - b); }
    cout << ans << endl;

    return 0;
}




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

inline void swap(int &a, int &b) { int t = a; a = b; b = t; }

int main()
{
  int a, b, c, d, e, f;
  
  while (cin >> a >> b >> c >> d >> e >> f)
  {
    int det = a*e-b*d;
    int x = e*c - b*f;
    int y = a*f - d*c;
    
    double xx = 0, yy = 0;
    if (x != 0) xx = (double)x/det;
    if (y != 0) yy = (double)y/det;
    printf("%.3f %.3f\n", xx, yy);
  }
  return 0;
}

Measured memory_bytes: 1196
#include <iostream>
using namespace std;
int main()
{
    int a ;
    int b ;
    cin >> a ;
    cin >> b ;
    int d [a] ;
    int e ;
    e = 0 ;
    int ans ;
    ans = 1;
    for(int i = 0;i < a ;i++ ){
        cin >> d [i] ;
        e = e + d[i];
        if(e <= b){
           ans = ans + 1;
        }

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

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main(){

	double x1, x2, y1, y2, a;

	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

	a = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);

	printf("%.11lf", sqrt(a));





	return 0;
}

Measured memory_bytes: 656
/*
____    ____ .___________.
\   \  /   / |           |
 \   \/   /  `---|  |----`
  \      /       |  |     
   \    /        |  |     
    \__/         |__|     
                          
 */


#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<iomanip>
#define ll long long
#define mod 1000000007
using namespace std;
const int INF = 2e9 + 1;


/*---------------Graph Class---------*/
class graph
{
private:
	ll novert;
	ll noedges;
	vector< vector<ll> > adjlist;
public:
	graph(ll n,ll m)
	{
		novert=n;
		noedges=m;
		adjlist.resize(n+1);	
	}
	
	void addedge(ll u,ll v)
	{
		//bidirectional
		adjlist[u].push_back(v);
		adjlist[v].push_back(u);	
	}
	
	void dfsutil(ll initvert,vector<bool>& visited,ll lastvert=-1)
	{
		if(lastvert==initvert)
		{
			//do something
		}
		visited[initvert]=true;
		for(auto itr:adjlist[initvert])
		{
			if(!visited[itr])
			{	
			}	
		}	
	}	
};
/*-----------------End of graph----------------*/





int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);


ll n,k,x,y,ans=0;
cin>>n>>k>>x>>y;

if(n<=k)
{
	cout<<(n*x)<<endl;
}
else
{
	cout<<(k*x)+(n-k)*y<<endl;
}

return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, i, j, k, c, s, t, id, ans;
	cin >> n >> c;
	vector<vector<pair<int, int>>> clist(c + 1);
	for (i = 0; i < n; i++) {
		cin >> s >> t >> id;
		clist[id].push_back({ s, t });
	}
	vector<pair<int, int>> plist;
	for (i = 1; i <= c; i++) {
		sort(clist[i].begin(), clist[i].end());
		for (j = 0; j < clist[i].size(); j++) {
			for (k = j + 1; (k < clist[i].size()) && (clist[i][k].first == clist[i][k - 1].second); k++);
			plist.push_back({ clist[i][j].first - 1, clist[i][k - 1].second });
			j = k - 1;
		}
	}
	sort(plist.begin(), plist.end());

	priority_queue<int> q;
	q.push(0);
	for (auto p : plist) {
		t = -q.top();
		if (t <= p.first) q.pop();
		q.push(-p.second);
	}
	ans = q.size();
	cout << ans << "\n";

	return 0;
}


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

int main() {
    int64_t N,M,X;
    int64_t cost_all = 0;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<int> D(M,0);//スキル
    vector<vector<int>> A(N, vector<int>(M));

    for(int i = 0; i < N; i++){
        cin >> C.at(i);
        for(int j = 0; j < M; j++){
            cin >> A.at(i).at(j);
        }
    }
    priority_queue<int, vector<int>, greater<int>> cost;

    for (int tmp = 0; tmp < (1 << 12); tmp++) {
        bitset<12> s(tmp);
        int flg = 1;
        cost_all = 0;
        for(int j = 0; j < M; j++){
            D.at(j) = 0;
        }
        for(int i = 0; i < N; i++){
            if(s.test(i) == 1){
                cost_all += C.at(i);
                for(int j = 0; j < M; j++){
                    D.at(j) += A.at(i).at(j);
                }
            }
        }
        for(int j = 0; j < M; j++){
            if(D.at(j) >= X){
                flg *= 1;
            }else{
                flg *= 0;
            }
        }
        if(flg == 1){
            cost.push(cost_all);
        }
    }
    if(cost.size() != 0){
        cout << cost.top() << endl;
    }
    else{
        cout << "-1" << endl;
    }
}

Measured memory_bytes: 3628
a = int(input())
b = int(input())
c = int(input())
x = int(input())
patterns = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                patterns += 1
print(patterns)


Measured memory_bytes: 3060
const Main = input => {
  const sp = input.split(' ').map(e => Number(e));

  const a = Math.ceil( sp[2] / sp[1] );
  const b = Math.ceil( sp[0] / sp[3] );

  const resultA = sp[0] - sp[3]*b;
  const resultB = sp[2] - sp[1]*a;

  console.log(a <= b ? 'Yes' : 'No');
};

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//Main(`10 9 10 10`);
//Main(`45 4 39 5`)


Measured memory_bytes: 29644
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
int NOEL(){
    cout<<-1<<endl;
    return 0;
}
#define N 100010
ll n,a[N],b[N];
unordered_map<ll,ll> A,B;
bool Cand(){
    a[n]=0;
    lol(i,n)a[n]=a[n] xor a[i];
    lol(i,n+1)A[a[i]]++;
    lol(i,n)B[b[i]]++;
    b[n]=-1;
    lol(i,n+1){
	if(A[a[i]]!=B[a[i]]){
	    if(b[n]!=-1)return 0;
	    b[n]=a[i];
	    B[a[i]]++;
	}
    }
    return 1;
}
unordered_map<ll,vector<ll> > g;
unordered_set<ll> vis;
unordered_set<ll> cur;
void dfs(ll x){
    if(cur.find(x)!=cur.end())return;
    vis.insert(x);
    cur.insert(x);
    for(auto y:g[x])dfs(y);
}
int main(){
    cin>>n;
    lol(i,n)cin>>a[i];
    lol(i,n)cin>>b[i];
    if(!Cand())return NOEL();
    lol(i,n+1){
	if(a[i]!=b[i])g[a[i]].push_back(b[i]);
    }
    ll ans=-2+(a[n]==b[n]);
    lol(i,n+1){
	if(vis.find(a[i])!=vis.end())continue;
	cur.clear();
	dfs(a[i]);
	if(cur.size()==1&&a[i]==a[n])ans++;
	if(cur.size()!=1)ans++;
    }
    for(auto x:vis){
	ans+=g[x].size();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 33316
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		//boolean[] flag = new boolean[3];
		int cnt = 0;
		
		int []count = new int[3];
		
		for(int i = 0; i < 3; i++) {
			count[i] = stdIn.nextInt();
		}
		
		Arrays.sort(count);
		
		for(int i = 0; i < 2; i++) {
			if(count[i]==count[i+1]) {
				cnt++;
			}
		}
		if(cnt==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, l, r, d);
  int ans = 0;
  for (int i = l; i <= r; ++i) {
    if (i % d == 0) ++ans;
  }
  out(ans);
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s, t;
    cin >> s >> t;
    if (t.substr(0, s.size()) == s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3624
n = int(input())
x = 1
i = 0
while x <= n:
    if x % 3 == 0:
        print(" %d"%x,end="")
    elif x % 10 == 3:
        print(" %d"%x,end="")
    else:
        i = x
        while i:
            i //= 10
            if i % 10 == 3:
                print(" %d"%x,end="")
                break
    x += 1
print()



Measured memory_bytes: 5872
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b; scanf("%d%d", &a, &b);
	
	if((a * b) & 1) printf("Odd\n");
	else printf("Even\n");
	return 0;
}


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

#define cal(i, n) for(int i = 0 ; i < n ; i++)
#define find(i, p, n) for(int i = p ; i <= n; i++)

using namespace std;

int main(){
    int N;
    vector<int> X(100);
    cin >> N;
    cal(i, N) cin >> X[i];
    int mintotal = 0;
    find(i, *min_element(X.begin(), X.end()),*max_element(X.begin(), X.end())){
        int total = 0;
        cal(j, N) total += int(pow(X[j] - i, 2));
        if(i == *min_element(X.begin(), X.end())){
            mintotal = total;
        }else{
            mintotal = min(mintotal, total);
        }
    }
    cout << mintotal;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n,i,k,ans,max=0,foundation=100,mizucount;
    vector<int> pyramid;
    vector<int> bottom;
    cin >>n;
    vector<int> h(n);
    for(i=0;i<n;i++)cin>>h[i];
    for(i=0;i<n;i++){
    if(foundation>h[i])foundation=h[i];
    if(max<h[i])max=h[i];
    }
   // h.push_back(0);
    for(i=1;i<=max;i++){
        mizucount=0;
        if(h[0]>=i)mizucount++;
        if(h[n-1]>=i)mizucount++;
        for(k=0;k<n-1;k++){
            if(h[k]<i&&h[k+1]>=i)mizucount++;
            if(h[k]>=i&&h[k+1]<i)mizucount++;
        }
        mizucount/=2;
        ans+=mizucount;
    }




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

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif


int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n;
    string str;
    cin >> n;
    cin >> str;

    if(str.size() <= n)cout << str << "\n";
    else{
        string s = str.substr(0,n);
        cout << s << "...\n";
    }


    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  set<string> st;
  rep(i,n) st.insert(s[i]);
  cout << st.size() << endl;
  return 0;
}


Measured memory_bytes: 25004
#include <iostream>
#include <iterator>
#include <array>
#include <set>
#include <algorithm>
#include <string>
#include <limits>

using namespace std;

int main()
{
  // skip the first line
  //cin.ignore(numeric_limits<streamsize>::max(), '\n');

  int n, m;
  cin >> n >> m;

  istream_iterator<int> ii {cin};
  istream_iterator<int> eos {};

  vector<int> A; // initially empty

  for (int i = 0; i < n*m; ++i) A.push_back(*(ii++));

  vector<int> B;

  copy(ii, eos, back_inserter(B));

  ostream_iterator<int> oi {cout, "\n"};
  for (int i=0; i <n; ++i)
    cout << inner_product(A.begin() + i*m, A.begin() + ((i+1)*m), B.begin(), 0) << endl;
}



Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int n;
ll a[100005],b[100005];
vector<ll>vec;
ll bit[100005];
int f(int x){
	return x&-x;
}
void add(int i,int x){
	for(int s=i;s<100005;s+=f(s)) bit[s]+=x;
}
int sum(int i){
	int res=0;
	for(int s=i;s>0;s-=f(s)) res+=bit[s];
	return res;
}
void cnt(vector<int>vvec){
    reverse(vvec.begin(),vvec.end());
	ll ret = 0;
	for(int i=0;i<vvec.size();i++){
		ret += sum(vvec[i]);
		add(vvec[i],1);
	}
	printf("%lld\n",ret);
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
		a[i] += (i?a[i-1]:0LL); vec.pb(a[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%lld",&b[i]);
		b[i] += (i?b[i-1]:0LL);
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<n;i++){
		if(b[i]-(i?b[i-1]:0LL) > vec[i]-(i?vec[i-1]:0LL)){
			puts("-1"); return 0;
		}
	}
	vector<int>c;
	for(int i=0;i<n;i++){
		c.pb(1 + lower_bound(vec.begin(),vec.end(),a[i])-vec.begin());
	}
	cnt(c);
}

Measured memory_bytes: 6932
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(100005, 0);
    rep(i, n) {
        cin >> a.at(i);
        b.at(a.at(i) + 1)++;
        b.at(a.at(i) + 2)++;
        b.at(a.at(i))++;
    }
    int maxi = 0;
    int ans;
    rep(i, 100005) {
        if (max(maxi, b.at(i)) == b.at(i)) {
            ans = b.at(i);
            maxi = b.at(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024