akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#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 sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int A, B; std::cin >> A >> B;

  std::vector<int> N(21);
  for(int i=0; i<=21; i++){
    if ( i == 0 ) N[i] = 1;
    else N[i] = N[i-1] - 1 + A;
  }
  
  int ans = 0;
  for(ans = 0; ans<=21; ans++){
    if ( B <= N[ans]) break;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=410;
const int Maxm=100010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
int n,m;
struct Edge{int x,y;}e[Maxm];
bool can[Maxn],f[Maxn][Maxn];
void work(int k)
{
	can[k]=true;
	f[k][k]=true;
	for(int i=m;i;i--)
	{
		int x=e[i].x,y=e[i].y;
		if(f[k][x]&&f[k][y]){can[k]=false;return;}
		if(!f[k][x]&&!f[k][y])continue;
		f[k][x]=f[k][y]=true;
	}
}
int main()
{
	int ans=0;
	n=read(),m=read();
	for(int i=1;i<=m;i++)e[i].x=read(),e[i].y=read();
	for(int i=1;i<=n;i++)work(i);
	for(int i=1;i<=n;i++)
	if(can[i])
	{
		for(int j=i+1;j<=n;j++)
		if(can[j])
		{
			bool flag=true;
			for(int k=1;k<=n;k++)
			if(f[i][k]&&f[j][k]){flag=false;break;}
			if(flag)ans++;
		}
	}printf("%d",ans);
}

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

char * seive(int sz){
    char* isprime = (char*)malloc(sz + 1);
    fill(isprime, isprime + sz + 1, true);
    isprime[0] = isprime[1] = false;
    for (int i = 2; i*i <= sz; i++){
        if (!isprime[i]) continue;
        for (int j = i*i; j <= sz; j += i){
            isprime[j] = false;
        }
    }
    return isprime;
}

int main(int argc, char ** argv) {
    char * isprime = seive(10000000 + 100);
    for (int n; scanf("%d", &n), n != 0;){
        while (!isprime[n] || !isprime[n - 2] || !isprime[n - 6] || !isprime[n - 8]) n--;
        printf("%d\n", n);
    }
    free(isprime);
}

Measured memory_bytes: 10824
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
ans = sum(s)
s.sort()
if ans%10 == 0:
    mi = ans
    for i in range(n):
        if s[i]%10 != 0:
            mi = s[i]
            break
    ans -= mi
print(ans)

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

int main(){
    int n,W;
    cin >> n >> W;
    int w[n],v[n];
    for(int i=0;i<n;i++)
        cin >> w[i] >> v[i];

    long long dp[n+1][W+1];
    for(int i=0;i<W+1;i++)
        dp[0][i] = 0;
    for(int i=1;i<n+1;i++){
        for(int j=0;j<W+1;j++){
            if(j-w[i-1]>=0)
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }

    cout << dp[n][W];

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  int sum = 0;
  for(int i = 0;i < n-1;i++){
    sum += data.at(i);
  }
  cout << sum+data.at(n-1)/2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char a[100];
  int i;
  scanf("%s",a);
  for(i=0;i<3;i++){
    if(a[i]==a[i+1]){
      printf("Bad\n");
      return 0;
    }
  }
  printf("Good\n");
  return 0;
}

Measured memory_bytes: 128
object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val data = Iterator.continually {
    val a  = scanner.nextInt
    val op = scanner.next.head
    val c  = scanner.nextInt

    (a, op, c)
  }

  val outputs = data.takeWhile(_._2 != '?').map {
    case (a, '+', c) => a + c
    case (a, '-', c) => a - c
    case (a, '*', c) => a * c
    case (a, '/', c) => a / c
    case (_,   _, _) => throw new ArithmeticException()
  }

  outputs.foreach(println)
}

Measured memory_bytes: 45036
#include<stdio.h>
int main()
{
	int a,b,c;
	int sum=0;
	scanf("%d %d %d",&a,&b,&c);
	for(int i=a;i<=b;i++)
	{
		if(c%i==0)
		sum++;
	}
	printf("%d",sum);
	printf("\n");
	return 0;
} 


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

class State{
public:
  string s;
  int rem;

  State(){}
  State(string s, int rem) :
    s(s), rem(rem){}
};

int main(){
  int n, q;
  queue<State> que;

  while(cin >> n >> q){
    for(int i = 0; i < n; i++){
      string name;
      int rem;
      cin >> name >> rem;
      que.push(State(name, rem));
    }

    int now = 0;

    while(!que.empty()){
      State st = que.front(); que.pop();

      if(st.rem <= q){
        now += st.rem;
        cout << st.s << " " << now << endl;
      }
      else{
        now += q;
        st.rem -= q;
        que.push(st);
      }
    }
  }
}

Measured memory_bytes: 4404
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
using namespace std;

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	char a1,a2,a3,a4,a5,a6;
	cin>>a1>>a2>>a3>>a4>>a5>>a6;

	if(a1==a6&&a2==a5&&a3==a4){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}
	

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;


int main(){
	char s[210];
	char s1[110], s2[110];
	cin >> s;
	int x = strlen(s);
	if (x % 2 == 1){
		x--;
	}
	x -= 2;
	while (2 < x) {
		s1[x / 2] = '\0';
		s2[x / 2] = '\0';
		strncpy(s1, s, x / 2);
		strncpy(s2, s + x / 2, x / 2);
		if (strcmp(s1, s2) == 0){
			cout << x << endl;
			break;
		}
		x -= 2;
	}
	if (x == 2){
		cout << x << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#from math import gcd
from fractions import gcd
def main():
    n, x = map(int, input().split())
    L = list(set(map(int, input().split())))
    dist = sorted(set([abs(l-x) for l in L]))
    ans = dist[0]
    for d in dist:
        ans = gcd(d, ans)
    print(ans)
main()

Measured memory_bytes: 22036
N, K = map(int, input().split())
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = 0
for mod_a in range(K):
    mod_b = (K - mod_a) % K
    mod_c = (K - mod_b) % K
    if mod_b == mod_c:
        total += mods[mod_a] * mods[mod_b] * mods[mod_c]
print(total)

Measured memory_bytes: 4632
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s;
  cin >> s;
  int ans = 0;
  REP(i, 3) ans += s[i]-'0';
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double r = sc.nextDouble(); System.out.printf("%.6f %.6f",r*r*Math.PI,2 * Math.PI*r); } } 


Measured memory_bytes: 28296
object Main extends App {
  val s = io.StdIn.readLine()
  val check = s.filterNot(_=='x')

  if(check!=check.reverse){
    println(-1)
    sys.exit()
  }

  var ans = 0
  var first = 0
  var latter = 0
  var i = 0
  while( i < (s.length + first + latter)/2){
    if( s(i - first) != s(-1+(-1)*i+latter+s.length) ){
      ans += 1
      if( s(i-first)=='x' ){
        latter += 1
      }else{
        first += 1
      }
    }
    i += 1
  }

  println(ans)

}


Measured memory_bytes: 29312
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll x;
    cin >> x;
    ll n = 0;
    long double t = 100.0;
    while (1)
    {
        n++;
        t *= 1.01;
        ll p = t;
        t = p;
        if (p >= x)
        {
            cout << n << endl;
            exit(0);
        }
    }
}


Measured memory_bytes: 3620
class Kruskal_UnionFind():
    # 無向グラフであるという前提に注意
    def __init__(self, N):
        self.edges = []
        self.rank = [0] * N
        self.par = [i for i in range(N)]
        self.counter = [1] * N

    def add(self, u, v, d):
        """
        u = from, v = to, d = cost
        """
        self.edges.append([u, v, d])

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            z = self.counter[x] + self.counter[y]
            self.counter[x], self.counter[y] = z, z
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def size(self, x):
        x = self.find(x)
        return self.counter[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def Kruskal(self):
        """
        return: 最小全域木のコストの和
        """
        edges = sorted(self.edges, key=lambda x: x[2])  # costでself.edgesをソートする
        res = 0
        for e in edges:
            if not self.same(e[0], e[1]):
                self.unite(e[0], e[1])
                res += e[2]
        return res

v,e = map(int,input().split())
stw = [ list(map(int,input().split())) for _ in range(e) ]

T = Kruskal_UnionFind(v)
for i in range(e):
    s = stw[i][0] - 1
    t = stw[i][1] - 1
    w = stw[i][2]
    T.add(s,t,w)

print(T.Kruskal())


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }

  vector<int> after;

  int index = 0;
  for (int i = 0; i < N; i++) {
    for (; index < N; index++) {
      if (a[index] == i + 1) {
        after.push_back(a[index]);
        break;
      }
    }
  }

  if (!after.empty()) {
    cout << a.size() - after.size() << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 2168
#include <iostream>

using namespace std;

static int n;
int solve();

int solve() {
  int ans = n;
  for (int i = 0; i <= n; i++) {
    int x = 0;
    int a = i;
    int b = n - i;
    while (a > 0) {
      x += a % 6;
      a /= 6;
    }
    while (b > 0) {
      x += b % 9;
      b /= 9;
    }
    ans = min(ans, x);
  }
  return ans;
}

int main() {
  cin >> n;
  cout << solve() << endl;
  return 0;
}


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

signed main(){
	int n,a,b;cin>>n>>a>>b;
	vector<int>seq;int cnt=0,cur=0,tmp=0;
	if(a+b>n+1||a*b<n)	
	{cout<<-1<<endl,exit(0);}
	if(a==1){for(int i=0;i<n;i++)seq.push_back(n-i);
	for(auto&& w:seq)cout<<w<<((&w==&seq.back())?"\n":" ");
	return 0;}
	vector<int>v;
	v.push_back(b);	
	int m=(n-b)/(a-1),r=(n-b)%(a-1);
	for(int i=0;i<a-1;i++)v.push_back(m+(i<r));
	int acm=0;
	for(auto&& w:v){
	for(int i=0;i<w;i++){
		seq.push_back(acm+w-i);		
	}acm+=w;
	}
	for(auto&& w:seq)cout<<w<<((&w==&seq.back())?"\n":" ");

}


Measured memory_bytes: 10220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,x); REP(i,sizeof(a)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  int N; cin>>N;
  REP(i,N){
    int a,b,c; cin>>a>>b>>c;
    if(a>b){ swap(a,b);}
    if(b>c){ swap(b,c);}
    cout<<( a*a+b*b==c*c ? LINY:LINN);
  }
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


//////////////////////////////////////
int main(){
    char c;
    cin>>c;
    if(c>='a'&&c<='z') cout<<"a"<<endl;
    else cout<<"A"<<endl;

    return 0;
}

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

using ll = long long;
constexpr int INF = 1<<30;

int dp[1005][10005];

void chmin(int &a, int b){
    a = min(a,b);
}

int main(){
    int h,n;
    cin >> h >> n;
    vector<int> a(n), b(n);
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i=0;i<=n;i++) {
        fill(dp[i], dp[i]+h+1, INF);
    }
    dp[0][h] = 0;
    for(int i=0;i<n;i++){
        for(int j=h;j>=0;j--){
            chmin(dp[i+1][j], dp[i][j]);
            chmin(dp[i][max(j-a[i],0)], dp[i][j]+b[i]);
        }
    }
    cout << dp[n][0] << endl;
    return 0;
}



Measured memory_bytes: 39424
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, beg, end) for (int i = (beg); i < (end); i++)
#define rrep(i, beg, end) for (int i = (beg); i >= (end); i--)
#define sp(i) setprecision(i) << fixed
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 30;
ull p_hash(ull x, ull y) { return (x + y) * (x + y + 1) / 2 + y; } //NxN->N
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll fast_power(ll a, ll b, ll p)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (ll)res * a % p;

        b >>= 1;
        a = (ll)a * a % p;
    }

    return res;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    ll f1 = fast_power(10, n, mod);
    ll f2 = fast_power(9, n, mod);
    ll f3 = fast_power(8, n, mod);
    ll a = (f1 + f3) % mod;
    cout << ((a - 2 * f2) % mod + mod) % mod << endl;

    return 0;
}

Measured memory_bytes: 3640
def minHeapify(x)
  l = 2*x
  r = 2*x+1
  if l <= $n && $heap[l][0] < $heap[x][0]
    minimum = l
  else
    minimum = x
  end
  if r <= $n && $heap[r][0] < $heap[minimum][0]
    minimum = r
  end
  if minimum != x
    $heap[x], $heap[minimum] = $heap[minimum], $heap[x]
    minHeapify(minimum)
  end
end
 
def extract
  key = $heap[1]
  $heap[1] = $heap[$n]
  $n -= 1
  minHeapify(1)
  key
end
 
def insert(key)
  $n += 1
  $heap[$n] = key
  i = $n
  while i > 1 && $heap[i/2][0] > $heap[i][0]
    $heap[i], $heap[i/2] = $heap[i/2], $heap[i]
    i /= 2
  end
end

def dijkstra(n, l, route, cost_d, cost_e)
  done = (n+1).times.map{ [false] * (l+1) }
  while true
    e, s, r = extract
    return e if s == n
    next if done[s][r]
    done[s][r] = true
    route[s].each do |t|
      insert([e + cost_e[s][t], t, r])
      if r >= cost_d[s][t]
        insert([e, t, r - cost_d[s][t]])
      end
    end
  end
end

loop do
  n, m, l = gets.split.map(&:to_i)
  break if n == 0
  $heap = []
  $n = 0
  route = (n+1).times.map{ [] }
  cost_d = (n+1).times.map{ [0] * (n+1) }
  cost_e = (n+1).times.map{ [0] * (n+1) }
  m.times.map do
    s, t, d, e = gets.split.map(&:to_i)
    route[s] << t
    route[t] << s
    cost_d[s][t] = cost_d[t][s] = d
    cost_e[s][t] = cost_e[t][s] = e
  end
  insert([0, 1, l])
  p dijkstra(n, l, route, cost_d, cost_e)
end

Measured memory_bytes: 13112
#include <stdio.h>

int main() {
	int w, n;
	int a[30][2];
	int ans[30];

	int i;

	scanf("%d", &w);
	scanf("%d", &n);

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

	for(i = 0; i < w; i++)
		ans[i] = i + 1;
	
	for(i = 0; i < n; i++) {
		int temp;

		temp = ans[a[i][0] - 1];
		ans[a[i][0] - 1] = ans[a[i][1] - 1];
		ans[a[i][1] - 1] = temp;
	}

	for(i = 0; i < w; i++)
		printf("%d\n", ans[i]);

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a,b,c,min=100000,sum,sum2,sum3;
	scanf("%d %d %d",&a,&b,&c);
	
	sum=a+b;
	sum2=b+c;
	sum3=a+c;
	
	if(sum<=min){
		min=sum;
	}
	
	if(sum2<=min){
		min=sum2;
	}
	if(sum3<=min){
		min=sum3;
	}
	
	printf("%d\n",min);
	return 0;
}

Measured memory_bytes: 128
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >>n;
    vector<int> a(n), b(n), c(n-1);
    for(int i = 0; i < n; i++)
        cin >>a[i];
    for(int i = 0; i < n; i++)
        cin >>b[i];
    for(int i = 0; i < n-1; i++)
        cin >>c[i];
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += b[a[i]-1];
        if(i > 0 && a[i] - a[i-1] == 1)
            ans += c[a[i-1]-1];
    }
    cout <<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
void yes(){
  cout << "Yes" << endl;
  exit(0);
}

void no(){
  cout << "No" << endl;
  exit(0);
}

int main() {
  ll n; cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  vector<ll> l(n+1), r(n+1);
  l[0] = -INF;
  r[0] = -INF;
  REP(i, n) l[i+1] = max(l[i], a[i]);
  REP(i, n) r[i+1] = max(r[i], a[n-i-1]);
  REP(i, n){
    cout << max(l[i], r[n-i-1]) << endl;
  }
}

Measured memory_bytes: 7552
n , m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0

for i in range(n):
    a = list(map(int, input().split()))
    check = 0
    for j in range(m):
        check += a[j] * b[j]
    if check + c > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>

using namespace std;

int main(){
        int ma =0;
        int t;cin>>t;
        int ans =0;
        for(int i=0;i<t;i++){
                int tmp;cin>>tmp;
                if(ma <= tmp) ans ++;
                ma = max(ma,tmp);
        }
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;
 
int main() {
    char a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    if (a == f && b == e && c == d) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll dp[n+1][4][4][4];
  mem(dp);
  dp[0][3][3][3]=1;
  ll ans=0;
  rep(i,n) {
    rep(j,4) {
      rep(k,4) {
        rep(l,4) {
          rep(h,4) {
            if(k==0&&l==1&&h==2) continue;
            if(k==0&&l==2&&h==1) continue;
            if(k==1&&l==0&&h==2) continue;
            if(j==0&&l==1&&h==2) continue;
            if(j==0&&k==1&&h==2) continue;
            dp[i+1][k][l][h]+=dp[i][j][k][l];
            dp[i+1][k][l][h]%=MAX;
          }
        }
      }
    }
  }
  rep(j,4)rep(k,4)rep(l,4) {
    ans+=dp[n][j][k][l];
    ans%=MAX;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

using namespace std;


inline long long  read(){
   long long  w=1,s=0;
   char ch=getchar();
   while(ch<'0'||ch>'9') {if (ch=='-') w=-1;ch=getchar();} 
   while(ch>='0'&&ch<='9')  s=s*10+ch-'0',ch=getchar();
   return s*w;
}

int main(){
    long long  n=read();
    if (n%2==0) cout<<n;
    else cout<<n*2;
    return 0;
}



Measured memory_bytes: 256
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))

def calc(mid,a):
    return ((a - mid) ** 2).sum()


for i in range(a.min(), a.max() + 1, 1):
    tmp = calc(i, a)
    if i == a.min():
        ans = calc(i, a)
    elif tmp < ans:
        ans = tmp
    else:
        pass

print(ans)

Measured memory_bytes: 12504
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod 1000000007
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class COneQuadrillionAndOneDalmatians {
public:
    string convertToTitle(ll n) {
        string ans;
        while (n) {
            ans = char ((n - 1) % 26 + 'a') + ans;
            n = (n - 1) / 26;
        }
        return ans;
    }
	void solve(std::istream& cin, std::ostream& cout) {
        ll n;
        cin>>n;
        cout<<convertToTitle(n);
	}
};


int main() {
	COneQuadrillionAndOneDalmatians solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
const int N=1000010;
struct E{
	int f,t,xt;
}e[N<<2];
struct P{
	int x,y,id;
	P(int a=0,int b=0):x(a),y(b){}
}px[N],py[N];
int h[N],cnt;
int D;
int val[N];
bool cmpy(const P&a,const P&b){
	return a.y==b.y?a.x<b.x:a.y<b.y;
}
bool cmpx(const P&a,const P&b){
	return a.x==b.x?a.y<b.y:a.x<b.x;
}
bool cmp1(const P&a,const P&b){
	if(a.x==b.x){
		return a.y<b.y;
	}else return a.x<b.x;
}
bool cmp2(const P&a,const P&b){
	if(a.y==b.y){
		return a.x<b.x;
	}else return a.y<b.y;
}
void adge(int f,int t){
	///printf("add <%d,%d>\n",f,t);
	e[++cnt]=(E){f,t,h[f]};h[f]=cnt;
	e[++cnt]=(E){t,f,h[t]};h[t]=cnt;
}
bool vis[N];
long long  ans=0;
void dfs(int u){
	vis[u]=1;
	for(int i=h[u];~i;i=e[i].xt) if(!vis[e[i].t]){
		dfs(e[i].t);
	}
}
bool v1[N],v2[N];
int main(){
	//freopen("out","w",stdout);		
	memset(h,cnt=-1,sizeof(h));
	int n,s1,s2;
	scanf("%d%d%d",&n,&s1,&s2);
	//puts("");
	int t1=0,t2=0;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&px[i].x,&px[i].y);
		if(i==s1) t1+=px[i].x,t2+=px[i].y;
		if(i==s2) t1-=px[i].x,t2-=px[i].y;
		int t=px[i].x+px[i].y;
		px[i].y=px[i].y-px[i].x;
		px[i].x=t;
		px[i].id=i;
		py[i]=px[i];
	}
	D=abs(t1)+abs(t2);
	//printf("D=%d\n",D);
	sort(py+1,py+1+n,cmpy);
	sort(px+1,px+1+n,cmpx);
	//puts("check px");for(int i=1;i<=n;i++) printf("%d %d (%d)\n",px[i].x,px[i].y,px[i].id);cout<<endl;
	//puts("check py");for(int i=1;i<=n;i++) printf("%d %d (%d)\n",py[i].x,py[i].y,py[i].id);cout<<endl;
	for(int i=1;i<=n;i++){
		P *p1,*p2;
		//printf("now= %d %d (%d)\n",px[i].x,px[i].y,px[i].id);
		p1=lower_bound(px+1,px+1+n,P(px[i].x+D,px[i].y-D),cmp1);
		p2=upper_bound(px+1,px+1+n,P(px[i].x+D,px[i].y+D),cmp1);
		//printf("p1:%d %d,p2:%d %d\n",p1->x,p1->y,p2->x,p2->y);
		val[px[i].id]+=p2-p1;
		if(p2-p1>0) adge(px[i].id,p1->id);
		for(;p2-p1>1;p1++){
			if(!v1[p1->id]) v1[p1->id]=1,adge(p1->id,(p1+1)->id);
		}
		//printf("val(%d)=%d\n",px[i].id,val[px[i].id]);
		//printf("now= %d %d (%d)\n",py[i].x,py[i].y,py[i].id);	
		p1=lower_bound(py+1,py+1+n,P(py[i].x-D,py[i].y+D),cmp2);
		p2=upper_bound(py+1,py+1+n,P(py[i].x+D,py[i].y+D),cmp2);
		//printf("p1:%d %d,p2:%d %d\n",p1->x,p1->y,p2->x,p2->y);
		val[py[i].id]+=p2-p1;
		if(p2-p1>0) adge(py[i].id,p1->id);
		if(p2>p1&&p1->x==py[i].x-D) val[py[i].id]--;
		if(p2>p1&&(p2-1)->x==py[i].x+D) val[py[i].id]--;
		for(;p2-p1>1;p1++){
			if(!v2[p1->id]) v2[p1->id]=1,adge(p1->id,(p1+1)->id);
		}
		//printf("val[%d]=%d\n",py[i].id,val[py[i].id]);
	}
	dfs(s1);
	for(int i=1;i<=n;i++) if(vis[i]) ans+=val[i];
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 42752
//DPするけど、遷移を節約する. DPするとO(N^2)なんて思ったのが間違いだったorz

#include <iostream>
using namespace std;

int n, m;
int x[100000], y[100000];
bool dp[100000];	//dp[i] = 箱iに赤いキャンディーがある状態(0, 1)
int cnt[100000];	//cnt[i] = 箱iにある飴の総数

int main() {
	int i;
	
	cin >> n >> m;
	for (i = 0; i < m; i++) { cin >> x[i] >> y[i]; x[i]--; y[i]--; }
	
	for (i = 0; i < n; i++) { dp[i] = false; cnt[i] = 1; }
	dp[0] = true;
	
	for (i = 0; i < m; i++) {
		if (!dp[x[i]]) { }
		else if (cnt[x[i]] == 1) { dp[x[i]] = false; dp[y[i]] = true; }
		else { dp[x[i]] = true; dp[y[i]] = true; }
		cnt[x[i]]--;
		cnt[y[i]]++;
	}
	
	int ans = 0;
	for (i = 0; i < n; i++) {
		if (dp[i]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1536
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""



n = onem()

a = input()

print(a.count("ABC"))






Measured memory_bytes: 3316
N, K = gets.split(' ').map(&:to_i)
R, S, P = gets.split(' ').map(&:to_i)
T = gets.chomp
# r グー, s チョキ p パー
result = 0

STR_R = "r"
STR_S = "s"
STR_X = "!"

N.times do |i|

  rsp = T[i]
  if i < K || rsp != T[i-K]
    case rsp
    when STR_R
      result += P
    when STR_S
      result += R
    else
      result += S
    end
  else
    T[i] = STR_X
  end
end
puts result

Measured memory_bytes: 1916
program golf
    implicit none
    integer k, a, b, i, flag
    read(*,*) k
    read(*,*) a, b
    flag=0

    if ( b-a+1 >= k ) then
        write(*,*) "OK"
    else
        do i = a, b
            if ( mod(i,k)==0 ) then
                flag=1
            end if
        end do
        if ( flag==1 ) then
            write(*,*) "OK"
        else
            write(*,*) "NG"
        end if
    end if
end program golf

Measured memory_bytes: 2852
s = gets.chomp.split("").map { |e| e.to_s }
c = false
f = false
s.each do |l|
	if l == "C"
		c = true
	end

	if c && l == "F"
		f = true
	end
end
if f
	puts "Yes"
else
	puts "No"
end

Measured memory_bytes: 1788
import math
import calendar
import fractions
import itertools

c = [[0, 0, 0] for _ in range(3)]

for i in range(3):
    a = list(map(int, input().split()))
    for j in range(3):
        c[i][j] = a[j]

x = min(c[0])
y = min(c[1])
z = min(c[2])
ans = 0
for a1 in range(x + 1):
    for a2 in range(y + 1):
        for a3 in range(z + 1):
            if a1 - c[0][0] == a2 - c[1][0] == a3 - c[2][0] and a1 - c[0][1] == a2 - c[1][1] == a3 - c[2][1] and a1 - c[0][2] == a2 - c[1][2] == a3 - c[2][2]:
                ans = 1
                break
        if ans == 1:
            break
    if ans == 1:
        break

if ans == 1:
    print("Yes")
else:
    print("No")


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

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

  sort(S.begin(),S.end());
  if(S.at(0) == 'a' && S.at(1) == 'b' && S.at(2) == 'c')
    cout << "Yes" << endl;
  
  else cout << "No" << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
const ll mod = 1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vec<pair<ll,char>> ap(a+b+c); rep(i,a+b+c)cin >> ap[i].first; 
    rep(i,a)ap[i].second = 'r'; for(ll i = a;i<a+b;i++)ap[i].second = 'g';
    for(ll i = a+b;i<a+b+c;i++)ap[i].second = 'n';
    sort(ap.begin(),ap.end());
    reverse(ap.begin(),ap.end());
    ll ans=0,num=0,i=0,rnum=0,gnum=0;
    while(num < x+y){
        if(ap[i].second == 'r'){
            if(rnum == x){
                i++;
            continue;
            }
            rnum++; num++;
            ans += ap[i].first;
            i++;
        }
        else if(ap[i].second == 'g'){
           if(gnum == y){
                i++;
            continue;
            }
            gnum++; num++;
            ans += ap[i].first;
            i++;
        }
        else {
            num++;
            ans += ap[i].first;
            i++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 4992
#include <stdio.h>
#include <iostream>

int main(int argc, char** argv)
{
    std::string S;
    std::cin >> S;

    const char*c= S.c_str();
    bool ret=true;

    for(int i=0;i<4;i++)
    {
        int counter=0;
        for(int j=0;j<4;j++)
        {
            if(c[i]==c[j]) counter++;
        }
        if(counter!=2){ret=false;}
    }
    if(ret)
    {
        std::cout << "Yes";
    }else
    {
        std::cout <<"No";
    }
        
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std;
#define ll long long
#define ull unsigned long long
#define up(i, a, b) for (int i = (a); i <= (b); i++)
#define down(i, a, b) for (int i = (a); i >= (b); i--)
#define mem(x, y) memset(x, (y), sizeof x)
#define ff first
#define ss second
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define sc(a) scanf("%d", &a)
#define scl(a) scanf("%lld", &a)
#define scs(a) scanf("%s", a)
#define pr(a, b) printf("%d%c", a, b)
#define prl(a, b) printf("%lld%c", a, b)
#define PQ priority_queue
#define ld long double
#define all(v) v.begin(), v.end()
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> V;

int a[100010];
int main(){
	int n;sc(n);
	up(i,1,n)sc(a[i]);
	int c=0;
	up(i,1,n)if(a[i]!=i)c++;
	if(c==0||c==2)printf("YES");
	else printf("NO");
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
using namespace std;

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

	int32_t N = s.size();
	set<string> substrs;
	for (int32_t k = 1; k <= K; k++) {
		for (int32_t i = 0; i < N + 1 - k; i++) {
			substrs.insert(s.substr(i, k));
		}
	}

	auto itr = substrs.begin();
	advance(itr, K - 1);
	cout << *itr << endl;

	return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
#define N 1000
#define INF 1<<21

int n,M[N][N];
int d[N];
int Q[2*N],head=0,tail=0;

void enq(int);
int deq(void);
void bfs(int);


int main(){
	int i,j,u,k,v;

	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++)M[i][j] = 0;
	}
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d %d",&u, &k);
		for(j=0;j<k;j++){
			scanf("%d",&v);
			M[u][v] = 1;
		}
	}
	bfs(1);
	for(i=1;i<=n;i++){
		if(d[i] == INF)d[i] = -1;
		printf("%d %d\n",i,d[i]);
	}
	return 0;

}

void enq(int x){
	Q[tail++] = x;
}

int deq(){
	return Q[head++];
}

void bfs(int s){
	int i,u,v;
	enq(s);
	for(i=1;i<=n;i++)d[i] = INF;
		d[s] = 0;
	while(head != tail){
		u = deq();
		for(v = 1;v <= n;v++){
			if(M[u][v] == 0)continue;
			if(d[v] != INF)continue;
			d[v] = d[u] + 1;
			enq(v);
		}
	}
}

Measured memory_bytes: 992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mxn= 2e5+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
vector<int> adj[mxn];
bool vis[mxn];
int dfs(int i){
    vis[i]=true;
    int temp=0;
    for(auto x: adj[i]){
        if(!vis[x])
        temp=temp+dfs(x);
    }
    return temp+1;
}
int main(){
   int n,m;
   cin>>n>>m;
    while(m--){
        int u,v;
        cin>>u>>v;
        u--,v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(!vis[i]){
            int temp=dfs(i);
            ans=max(ans,temp);
        }
    }
    cout<<ans;
}

Measured memory_bytes: 24024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

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

  if(S == "ABC")
  cout << "ARC" << endl;
  else
    cout<<"ABC"<<endl;
  return 0;
}


Measured memory_bytes: 3624
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
template <class t> inline void read(t &s)
{
	s=0;
	reg int f=1;
	reg char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	s*=f;
	return;
}
int n;
int a[1005];
signed main(void)
{
	cin>>n;
	for(int i=1;i<=n;++i)
		read(a[i]);
	for(int i=1;i<=n;++i)
		if(!(a[i]&1))
		{
			if(a[i]%3>0&&a[i]%5>0)
			{
				puts("DENIED");
				return 0;
			}
		}
	puts("APPROVED");
	return 0;
}



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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)

//repetition
//------------------------------------------
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T> ostream & operator<<(ostream& os, vector<T> const& v){
        for(auto it=v.begin(); it!=v.end(); ++it){
            os << *it << (it+1==v.end() ? "" : ",");
        }
        return os;
    }
}

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

int lcm(int a,int b){
   return a*b/__gcd(a,b);
}
 
vb pn((int)1e4+10); 
void prime_number(int n){
   fill(all(pn),true);
   pn[0]=false;pn[1]=false;
   loop(i,2,n/2+1){
      if(!pn[i]) continue;
      for(int j=2;i*j<=n;j++){
         pn[i*j]=false;
      }
   }
}

int main(){
   string s;
   while(cin>>s){
      rep(i,s.size()){
         if(s[i]=='@'){
            i++;
            rep(j,s[i]-'0') cout << s[i+1];
            i++;
         }
         else cout << s[i];
      }
      cout << endl;
   }
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;
    vector<ll> T(N);

    ll total = 0;
    REP(i, N){
        cin >> T[i];
        total += T[i];
    }

    ll M;
    cin >> M;

    vector<ll> P(M);
    vector<ll> X(M);

    ll temp = 0;
    REP(i, M){
        cin >> P[i] >> X[i];
        cout << total + X[i] - T[P[i]-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
			int a = sc.nextInt();
			String op= sc.next();
			int b = sc.nextInt();
			if(op.equals("+")){
				System.out.println(a+b);
			}else if(op.equals("-")){
					System.out.println(a-b);
			}else if(op.equals("*")){
				System.out.println(a*b);
			}else if(op.equals("/")){
					System.out.println(a/b);
			}else{
				break;
			}
		}
	}
}

Measured memory_bytes: 26208
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

class Main
{
	public static void main(String[] args) throws Exception
	{
		invoke(System.in);
	}

	public static void	invoke(InputStream is) throws IOException
	{
		// input
		BufferedReader	reader = new BufferedReader(new InputStreamReader(is));
		String	line = reader.readLine();
		String[]	va = line.split(" ");
		int a = Integer.parseInt(va[0]);
		int b = Integer.parseInt(va[1]);

		line = reader.readLine();
		char[]	ca = line.toCharArray();

		try
		{
			int	i;
			for (i = 0; i < a; ++i)
			{
				if ('0' <= ca[i] && ca[i] <= '9')
				{

				}
				else
				{
					System.out.println("No");
					return;
				}
			}

			if (ca[i++] != '-')
			{
				System.out.println("No");
				return;
			}

			for (int j = 0; j < b; ++i, ++j)
			{
				if ('0' <= ca[i] && ca[i] <= '9')
				{

				}
				else
				{
					System.out.println("No");
					return;
				}
			}
			System.out.println("Yes");
		}
		catch (Exception e)
		{
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
const int maxn = 100000;



int main(){
    
    ll n,a,b;
    ll x[maxn];
    ll ans=0;
    ll mod=INF;
    cin >> n>>a>>b;
    rep(i,n){
        cin >> x[i];
    }
    
    rep(i,n-1){
        if((double)a>(double)b/(double)(x[i+1]-x[i])){
            ans +=b;
        }else{
            rep(j,x[i+1]-x[i]){
                ans += a;
            }
        }
        //cout <<ans<<endl;
    }
    
    cout << ans<<endl;
    
    return 0;
}


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

int main() {
  int N,M,X;
  int minprice=10000000;
  cin >> N >> M >> X;
  vector<int> price=vector<int>(N);
  vector<vector<int>> know(N,vector<int>(M));
  for(int i=0;i<N;i++){
    cin >> price.at(i);
    for(int j=0;j<M;j++){
      cin >>  know.at(i).at(j);
    }
  }
  for (int tmp = 0; tmp < (1 << N); tmp++){
    bitset<12> s(tmp);
    int sum=0;
    vector<int> known(M,0);
    for(int i=0;i<N;i++){
      if(s.test(i)){
        sum+=price.at(i);
        for(int j=0;j<M;j++){
          known.at(j)+=know.at(i).at(j);
        }
      }
    }
    int flag=0;
    for(int j=0;j<M;j++){
      if(known.at(j)<X)flag=1;
    }
    if(flag==0){
        minprice=min(minprice,sum);
    }
  }
  if(minprice!=10000000)cout << minprice << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmin(T& a, U b){T bb = b;if(a>bb){a = bb;return 1;}return 0;}
template<class T, class U> inline bool chmax(T& a, U b){T bb = b;if(a<bb){a = bb;return 1;}return 0;}
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
#define double long double
#define PI 3.141592653589793
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1e16;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

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

/*
void dijkstra(){
  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;pq.push(make_pair(0,0));
  rep(i,110000)d[i] = INF;d[0] = 0;
  while(!pq.empty()){
    pair<int,int> from = pq.top();pq.pop();
    int fromV = from.second, fromC = from.first;
    if(d[fromV] < fromC)continue;
    rep(i,g[fromV].size()){
      int to = g[fromV][i];
      if(d[to] <= fromC+costs[to])continue;
      d[to] = fromC+costs[to];
      pq.push(make_pair(d[to], to));
    }
    //cout << fromV << " " << fromC << endl;
  }
}*/

int n;double x[8], y[8];
signed main(){
  cin>>n;rep(i,n)cin>>x[i]>>y[i];
  vector<int> v;rep(i,n)v.push_back(i);
  double ans = 0;
  do{
    rep(i,n-1){
      double dx = x[v[i+1]]-x[v[i]], dy = y[v[i+1]]-y[v[i]];
      ans += sqrt(dx*dx + dy*dy);
    }
  }while(next_permutation(v.begin(),v.end()));
  repd(i,1,n+1)ans /= i;
  cout << fixed << setprecision(12) << ans << endl;
}



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

int main() {
  int k,n;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(), p.end());
  int res=0;
  rep(i,k) res+=p[i];
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3624
data class XY(var x: Int, var y: Int) {
    constructor(xy: List<Int>): this(xy[0], xy[1])
}
fun main(args: Array<String>) {
    val N = nextInt()
    val R = Array(N) { XY(listOfInt()) }.sortedByDescending { it.y }
    val B = Array(N) { XY(listOfInt()) }.sortedBy { it.x }.toMutableList()
    var ans = 0
    for (r in R) {
        for (b in B) {
            if (r.x < b.x && r.y < b.y) {
                ans += 1
                B.remove(b)
                break
            }
        }
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt(d: Int = 0) = listOfString().map { it.toInt() + d }
fun listOfLong(d: Long = 0) = listOfString().map { it.toLong() + d }




Measured memory_bytes: 37996
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i = (s);i<(int)(n);i++)

int main(){
    int r , d, x;
    cin >> r >> d >> x;
    rep(i,10){
        x = r * x - d;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
  //nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(x);
    Read(a);
    Readln(b);

    if abs(a-x)<abs(b-x) then
      Writeln('A')
    else
      Writeln('B');

    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 128